【发布时间】:2020-12-16 11:06:34
【问题描述】:
在使用存储在云 Firestore 中的颤振处理数据方面,我需要帮助。我创建了一个功能,当您点击图标时添加数据并在您点击 2 次时删除。
这是我的代码:
void switcherIsFavSalon() async {
var firebaseUser = await FirebaseAuth.instance.currentUser();
var docRef = Firestore.instance
.collection('customers')
.document(firebaseUser.uid)
.collection('favSalons');
if (isFavSalon == false) {
setState(() {
favIcon = 'assets/icons/heart_filled.png';
isFavSalon = true;
docRef.add({
"salonName": widget.salonName,
"workTime": widget.workTime,
"location": widget.location,
"rating": widget.rating
// here is add method
});
});
} else {
setState(() {
favIcon = 'assets/icons/heart_border.png';
isFavSalon = false;
docRef. //i need delete method here
});
}
}
谁能帮助我,因为我是新手。
【问题讨论】:
标签: firebase flutter google-cloud-firestore