Trying to access data from Firestore real-time database, but I get this message all the time and other couple messages. how can I access the data in this situation? Thank you in advance
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
FirestoreCrud firestoreCrudRef = new FirestoreCrud();
Stream<QuerysnapShop> blogsSnapShot;
@override
void initState() {
firestoreCrudRef.readData().then((result) {
blogsSnapShot = result;
});
super.initState();
}
Widget blogList() {
return Container(
child: StreamBuilder<QuerysnapShop>(
stream: blogsSnapShot,
builder: (context, snapshot) {
return ListView.builder(
scrollDirection: Axis.vertical,
physics: ScrollPhysics(),
padding: EdgeInsets.only(top: 24),
itemCount: snapshot.data.documents.length,
shrinkWrap: true,
itemBuilder: (context, index) {
return BlogTile(
author: snapshot.data.documents[index].data()['author'],
title: snapshot.data.documents[index].data()['tile'],
body: snapshot.data.documents[index].data()['body'],
imageUrl: snapshot.data.documents[index].data()['imageUrl'],
);
},
);
}),
);
}