Skip to content

CSCI4100U/lab-7-printhaider

Repository files navigation

<<<<<<< HEAD

Lab 07

The starter code for lab 07.

Overview

For this lab, you will modify the previous lab to use Firestore Cloud as its data source. The result will be that it could share the data between clients (if using the same account), and changes made by one client will be automatically visible to other clients.

Instructions

The previous lab had you develop a model which uses SQLite, such that it was kept separated from the user interface. This will make it somewhat easier for us to migrate to a cloud database.

Changes to the Model

The Grade class should remain mostly the same, but you will need to add a DocumentReference instance variable to it (called reference), and change the type of id to be String (since we will now be using the auto-generated-by-FireStore DocumentID as our id, which can be accessed via our new reference field).

The GradesModel class needs to be heavily modified, since nearly all of the functionality will be different. Most of the data functions with Firestore Cloud are very simple, often one line of code, so this class will get reduced in size significantly. Now that Grade has a DocumentReference instance variable, making updates to the data store should be easy.

Changes to the User Interface

While it is normally desirable to make minimal changes to the user interface, in this case we need to since we want to support live updates when data is modified in our cloud store. We'll accomplish this task by using a StreamBuilder. StreamBuilder is a class which expects a stream of data, and re-builds the UI when the data has changed. We've used this class in the in-class demo. This StreamBuilder will now be used to build the ListView created in the previous lab. The GradesModel methods can be used as the data source for this StreamBuilder, as well as the mechanisms for creating, updating, and deleting Grades from the data store.

Getting Help

If you run into difficulty, you may wish to check out some of the following resources:

Of course, you can always ask the TA for help! However, learning how to find the answers out for yourself is not only more satisfying, but results in greater learning as well.

How to Submit

Create your flutter project inside this folder, commit, and then push your code to this repository to submit your lab assignment.

lab7

A new Flutter project.

Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

4c7c15e (done)

About

lab-7-printhaider created by GitHub Classroom

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published