I've checked all the data and it seems like the data is going through, but not displaying. This code is part of what I used for an earlier version of Flutter (and the code worked) but after the update it stopped working. It appears that the application is receiving some sort of response from Firebase but not the data.
I would like to be able to display the documents in my firebase collection.
There doesn't seem to be any error currently.
I've attached the code and console output.
class _Steambuilder2State extends State<Steambuilder2> {
@override
Widget build(BuildContext context) {
return Container(
child: StreamBuilder(
stream: _firestore.collection(collectionName).snapshots(),
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if(!snapshot.hasData){
return Center(
child: CircularProgressIndicator(),
);
}
else {
final foods = snapshot.data.docs;
List<Widget> widList = [];
for (var food in foods){
Map map = food.data();
List<dynamic> flavanoids = map['nutrientList'];
String name = map['name'];
String calories = map['calories'];
print(food.data.toString());
widList.add(ButtonFood(height:100, child: Row(children: [Text(calories), Text(name)]), mapVar: flavanoids));
}
return ListView(
children: widList,
);
}
}
),
);
}
}
Closure: () => Map<String, dynamic> from: function () { [native code] }
Closure: () => Map<String, dynamic> from: function () { [native code] }
Closure: () => Map<String, dynamic> from: function () { [native code] }
Closure: () => Map<String, dynamic> from: function () { [native code] }
Closure: () => Map<String, dynamic> from: function () { [native code] }
Closure: () => Map<String, dynamic> from: function () { [native code] }