错误:“_JsonDocumentSnapshot”类没有实例获取器“docs”

时间:2021-05-19 10:04:27

标签: firebase flutter dart

我正在尝试从 firebase 获取特定 uid 文档的列表,这是代码

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();
                              });
                        }),

错误:

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

我的收藏

the collection image

我正在尝试从该文档 uid 中获取列表 谢谢

0 个答案:

没有答案