September 2019
Beginner
512 pages
12h 52m
English
Before, when using mock data, we only needed to change our lists in memory. Now, we need to update our corresponding favor documents on Firebase so that this will trigger our previously defined callback, which will cause a rebuild and update our layouts.
We create a new method that will be used on every favor change, _updateFavorOnFirebase():
void _updateFavorOnFirebase(Favor favor) async { await Firestore.instance .collection('favors') // 1 .document(favor.uuid) // 2 .setData(favor.toJson()); // 3 }
The beginning of the Firestore call is almost always the same: we get the Firestore instance, then we complete the following steps:
Read now
Unlock full access