【发布时间】:2021-08-08 22:11:09
【问题描述】:
StreamBuilder(
stream: firestore
.collection('Product')
.doc(order.productId)
.collection('AbleToReview')
.doc(auth.currentUser.uid)
.snapshots(),
builder: (context, snapshot) {
if (snapshot.hasError) {
return Text('Something went wrong');
}
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child: CircularProgressIndicator(),
);
}
if (snapshot.data==null){
return Text('no data');
} else {
return Text('have data');
}
}
)
有时 firestore.collection('Product').doc(order.productId).collection('AbleToReview').doc(auth.currentUser.uid).snapshots() 中没有数据 查询。由于取决于数据是否存在,我尝试重新使用不同的小部件。但是snapshot.data==null 或!snapshot.hasData 不是我想要的正确方式。
【问题讨论】:
标签: flutter google-cloud-firestore flutter-layout