How to fix 'getter “documents” was called on null.' in flutter
问题 I am using flutter and firebase to create a mobile app. I have 2 collections on my firestore and i wanna read all documents in a the collection "posts". However, when I do that, an error saying the getter "documents" was called on null. Widget getContent(BuildContext context) { return StreamBuilder<QuerySnapshot>( stream: Firestore.instance.collection("posts").snapshots(), builder: (context, snap) { return CarouselSlider( enlargeCenterPage: true, height: MediaQuery.of(context).size.height,