确保将命令发送到 firestore
Making sure of sending commands to firestore
我如何确定 firestore 的这一系列命令将完全完成?
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();
}));
更清楚:我如何确定如果发生任何问题、错误或错误,不会导致命令之间的中断,只发送第一个或第二个命令!
如果您要问如何以事务方式操作数据,我建议您使用 using a transaction. If you don't need any existing data from the documents, you can also use a batched write 操作,它会更简单一些。
我如何确定 firestore 的这一系列命令将完全完成?
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();
}));
更清楚:我如何确定如果发生任何问题、错误或错误,不会导致命令之间的中断,只发送第一个或第二个命令!
如果您要问如何以事务方式操作数据,我建议您使用 using a transaction. If you don't need any existing data from the documents, you can also use a batched write 操作,它会更简单一些。