Error: Class '_JsonDocumentSnapshot' has no instance getter 'docs'

Viewed 1161

i am trying to get list of a particular uid document from firebase here is the code

StreamBuilder(
                        stream: firestore
                            .collection('interest')
                            .doc('${auth.currentUser.uid}')
                            .snapshots(),
                        builder: (context, snapshot) {
                          if (!snapshot.hasData) {
                            return Center(
                              child: CircularProgressIndicator(),
                            );
                          }
                          return ListView.builder(
                              itemCount: snapshot.data.docs.length,
                              itemBuilder: (context, index) {
                                return Container();
                              });
                        }),

Error:

Class '_JsonDocumentSnapshot' has no instance getter 'docs'.
Receiver: Instance of '_JsonDocumentSnapshot'
Tried calling: docs

my collection

the collection image

i am try to get the list from this document uid Thanks

1 Answers

Try (BuildContext context, AsyncSnapshot snapshot)

Related