我尝试过做一个新的StreamBuilder
在我的初始流的构建器内,虽然我没有收到任何错误,但它似乎也不起作用。这可以吗?
基本上,我正在访问 Firebase 中的根集合。该集合包含两个文档,我需要每个文档的数据,因为我正在构建一个包含来自两个路径的信息的数据表。
编辑:嵌套的 StreamBuilder 不起作用,因为 StreamBuilder 必须返回一个小部件,所以至少我知道它为什么不起作用。但我仍然没有决定要做什么。
你可以这样使用它:
StreamBuilder(
stream: firestore.collection("nameofcollection").doc.snapshots(),
buider: (context, AsyncSnapshot snapshot){
if(snapshot.hasError) return Text('your error');
if(snapshot.hasData){
typeList List nameList = [];
snapshot.forEach((e){
typeObject object = ();
object.property1 = e.get('property1Database');
object.property2 = e.get('property2Database');
nameList.add(object);
});
//now use the list that will be loaded with the 2 documents
}
}
);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)