error when trying to use StreamBuilder<QuerySnapshot>
126
Another point is to check if your list has items and if the firebase path is correct

Author by
Jorge Ribeiro
Student of systems analysis and development 5th sem. Graduated in UX|UI Design. 2 years of experience in technology with knowledge in web / mobile
Updated on January 03, 2023Comments
-
Jorge Ribeiro 13 minutes
hello people get this error when trying to use QuerySnapshot
child: StreamBuilder<QuerySnapshot>( stream: FirebaseFirestore.instance.collection('messages').snapshots(), builder: (context, snapshot) { switch (snapshot.connectionState) { case ConnectionState.none: case ConnectionState.waiting: // ignore: prefer_const_constructors return Center( // ignore: prefer_const_constructors child: CircularProgressIndicator(), ); default: List<DocumentSnapshot> documents = snapshot.data!.docs.reversed.toList(); return ListView.builder( itemCount: documents.length, reverse: true, itemBuilder: (context, index) { return ListTile( title: Text(documents[index]['text']), ); }); } }, ),
Exception caught by widgets library The following _CastError was thrown building StreamBuilder<QuerySnapshot<Object?>>(dirty, state: _StreamBuilderBaseState<QuerySnapshot<Object?>, AsyncSnapshot<QuerySnapshot<Object?>>>#b7dc5):Null check operator used on a null value
-
Gabriel Almeida 10 monthsHave you tried putting a breakpoint on the Title line?
-