I have an application under construction I want to access, in FIRESTORE I have several countries as a doc and within each country I have a collections and inside the collections I have a list of doc I need access to all.
Example:
My Code:
Stream<List<RecentChat>> getFavo({userId , countryName}) {
List<CountryModel> country;
for(CountryModel c in countryName) {
var ref = _db.collection('country').doc(c.countryName).collection('chat').where("likes", arrayContains: userId).snapshots();
return ref.map((snap) => snap.docs.map((doc) => RecentChat.fromJson(doc.data())).toList());
}
}
Current Behavior: Only the first doc is returned.
Desired Behavior: Return all the docs.