Relative Content

Tag Archive for flutterfirebasedartgoogle-cloud-firestorestream-provider

Reload stream provider when nested child object changes

Description I have the following object structure, making use of the firestore nested collections: class A { final String name; final List<B> bs; final String createdBy; } To retrieve data i wrote a stream: Stream<List<A>> get allA{ return aCollection.snapshots().asyncMap((snapshot) async { return Future.wait(snapshot.docs.map((doc) async { final bSnapshots= await bCollection(doc.reference).get(); final bs = bSnapshots.docs.map((doc) => doc.data()).toList(); […]

[Flutter][Firebase] Reload stream provider when nested child object changes

Description I have the following object structure, making use of the firestore nested collections: class A { final String name; final List<B> bs; final String createdBy; } To retrieve data i wrote a stream: Stream<List<A>> get allA{ return aCollection.snapshots().asyncMap((snapshot) async { return Future.wait(snapshot.docs.map((doc) async { final bSnapshots= await bCollection(doc.reference).get(); final bs = bSnapshots.docs.map((doc) => doc.data()).toList(); […]