I have several document id's and want to run a function after all of them are gathered.
Right now my code looks like this:
List<Future<DocumentSnapshot>> futures = [];
currentVenuesIds.forEach((currentVenueId) {
Future<DocumentSnapshot> venueFuture = Firestore.instance
.collection('venues')
.document(currentVenueId)
.get();
futures.add(venueFuture);
});
futures.getAll(...) //????????? This does not exist
In Cloud Firestore documentation there is a method called getAll()
: https://cloud.google.com/nodejs/docs/reference/firestore/0.13.x/Firestore#getAll
Is there something like this for Flutter
SDK? If not, what is the best way to get()
multiple documents from the server in a parallel manner and know that all of their promise/future
s are resolved?