How can I be sure that this sequence of commands to firestore will be done completely?
FirebaseFirestore.instance
.collection('Example')
.doc(Example.id)
.collection("Example")
.doc(Example.iD)
.delete()
.then((_) => FirebaseFirestore.instance
.collection('Example')
.doc(Example.iD)
.collection("Example")
.doc(Example)
.delete())
.then((_) => FirebaseFirestore.instance
.collection("Example")
.doc(Example.id)
.delete()
.then((_) {
_privateChatInfoList.removeWhere((key, value) => key == id);
notifyListeners();
}));
To be more clear : how I can be sure that if any problem, error or bug happen will not cause an interruption between commands to just send the first or the second one only!
CodePudding user response:
If you're asking how to transactionally manipulate data, I'd recommend using a transaction. If you don't need any existing data from the documents, you can also use a batched write operation, which is a bit simpler.