I'm trying to use a collectiongroup query to fetch items from firestore however no data is returned. I'm sure the data is there because I have a print statement that prints out some of this data.
This is how my code is structured
getSpotinfo() async {
//get data from userSpots collectionGroup
await FirebaseFirestore.instance.collectionGroup("userSpots").get();
}
FutureBuilder<dynamic>(
//This is always returning the circular progress indicator
future: getSpotinfo(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: totalSlots > 4 ? 4 : totalSlots,
itemBuilder: (context, i) {
return Text(
snapshot.data[i]["spaceName"]);
});
} else {
return CircularProgressIndicator();
}
},
)