I have snapshot of a firestore collection,
fireStoreInst.collection(widget.loggedInUser.uid)
.doc('subjects')
.collection(widget.deckName).snapshots()
and I want to update the data inside which according to Flatbutton click(hard/good/easy).
when user click any of these 3 buttons I want to update the respective data to true and other 2 to false.
As I don't know the docID, I tried,
1.
widget.snapshot.data.docs[widget.cardIndex].updateData({
widget.hardness: true,
widget.remove1: false,
widget.remove2: false
});
- And for getting the DocumentID I tired,
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
});
But all ended up in errors. most of them due to deprecated codes can anyone help me?
question from:
https://stackoverflow.com/questions/65931776/firestore-document-update-data-without-id 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…