【发布时间】:2021-06-30 02:25:29
【问题描述】:
我是 Flutter 和 firebase 集成的新手,在从 firebase 集合中检索所有数据时遇到了一些麻烦。
这个方法我试过了:
getCollection() {
CollectionReference coleccion =
FirebaseFirestore.instance.collection('materias');
return Container(
child: StreamBuilder(
stream: coleccion.doc('aprobadas').snapshots(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.active) {
return Text(snapshot.data.data()['codigo'],
style: TextStyle(fontSize: 50, color: Colors.white));
} else {
return CircularProgressIndicator();
}
},
),
);
}
现在我有点沮丧,因为我尝试了不同的方法但不起作用。
非常感谢所有帮助。
最好的问候
【问题讨论】:
-
你得到什么错误/你用这个方法遇到什么问题?
-
快照数据为空,循环进度指示器卡住,我在firebase控制台查看数据,有需要显示的数据
-
如果你使用
snapshot.connectionState == ConnectionState,done会发生什么?
标签: firebase flutter google-cloud-firestore