I'm trying to make a simples stream from Cloud Firestore. There is content inside of my Firestore data but the Stream doesn't seem to work.
This is how I build the Stream:
body: StreamBuilder(
stream: Firestore.instance.collection('user_data').document('rCqMQ3oLjBLk6yg6P1oT').collection('Buttons').snapshots(),
builder: (context, snapshot) {
if (snapshot.hasError){
return Container(color: Colors.red);
}
if (!snapshot.hasData){
return Center(child: CircularProgressIndicator());
}
if (snapshot.hasData){
return GridView.count(
padding: EdgeInsets.all(15),
crossAxisSpacing: 20.0,
mainAxisSpacing: 20.0,
crossAxisCount: 3,
children: [
CreateCard("ola"),
GestureDetector(
onTap: () async{
print(snapshot.data);
},
child: Container(
color: Colors.black,
width: 150,
height: 150,
child: Icon(Icons.add, color: Colors.white,),
),
),
],
);
}
}
But it always enters in the ``ìf(!snapshot.hasData)```
Database image: