【发布时间】:2020-12-17 07:17:54
【问题描述】:
我有一些代码:
getFavSalons(AsyncSnapshot<QuerySnapshot> snapshot) {
return snapshot.data.documents
.map((doc) => SalonBlock(
salonName: doc["salonName"],
location: doc["location"],
workTime: doc["workTime"],
rating: doc["rating"],
))
.toList();
}
以及我构建列表的部分代码:
StreamBuilder(
stream: Firestore.instance
.collection("customers")
.document("HAQaVqCPRfM7h6yf2liZlLlzuLu2")
.collection("favSalons")
.snapshots(),
builder:
(context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (snapshot.hasData) {
return Container(
margin:
EdgeInsets.only(bottom: screenHeight * 0.33),
child: new ListView(
children: getFavSalons(snapshot),
),
);
}
return LoadingSalon();
}),
这里我使用 uid:
.document("HAQaVqCPRfM7h6yf2liZlLlzuLu2")
这里我必须使用 currentUser 而不是填写自己。如何做到这一点?
【问题讨论】:
标签: firebase flutter dart google-cloud-firestore firebase-authentication