[英]firestore document update data without id
我有一个 firestore 集合的快照,
fireStoreInst.collection(widget.loggedInUser.uid)
.doc('subjects')
.collection(widget.deckName).snapshots()
我想根据 Flatbutton click(hard/good/easy) 更新其中的数据。 当用户单击这 3 个按钮中的任何一个时,我想将相应的数据更新为 true,将其他 2 个更新为 false。
因为我不知道 docID,所以我试过了,
1.
widget.snapshot.data.docs[widget.cardIndex].updateData({
widget.hardness: true,
widget.remove1: false,
widget.remove2: false
});
docID: snapshot.data.docs[cardIndex].documentID
FirebaseFirestore.instance
.collection('JWfsiG4VAQPpv3PNwP7E5dNbGEe2')
.doc('subjects')
.collection('Latest QA')
.doc(widget.docID)
.update({
widget.hardness: true,
widget.remove1: false,
widget.remove2: false
});
但都以错误告终。 其中大部分是由于已弃用的代码,任何人都可以帮助我吗?
问题解决了:
docID: snapshot.data.docs[cardIndex].id
代替
docID: snapshot.data.docs[cardIndex].documentID
documentID
ID 已弃用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.