I am making a firebase query which must return a list of object as stream.So to achieve that I am using Async* to wait for my loop for to complete before continueing the process.
But the problem is that, my function stopped in If condition and does not enter inside his for loop and my function does not return anything.
Yours helps would be welcome.
Here is my code
Stream<List<InfoCompagnie>> fetchCompanies(
String depart, String arrivee, String jour, int place) async* {
var q = await db.collection('DISPONIBILITE').snapshots();
await for (var q1 in q) {
for (var compagnies in q1.documents) {
var NomCompagnie = compagnies.data[firstCaseDate];
for (var compagnie in NomCompagnie) {
await for (var q2 in qq) {
if (q2.documents.isNotEmpty) {
//Making condition here
for (var data in q2.documents) {
await compagnieList
.add(infoCompagnie.value); //add Object here into list
}
yield compagnieList; //return stream data here
}//Function stopped here
}
}
}
}
}