我发现 some issue thread 与人们也无法完成交易,但它甚至没有提供解决方案。
问题
突然,我的 transactions crashes 使用 transaction.get
时。
runTransaction(
(Transaction transaction) async {
await transaction.get(documentReference); // "Timed out waiting for Task"
}
PlatformException
也没有真正帮助我,因为它在 platform_channel
中崩溃了......E/flutter (16297): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (16297): PlatformException(Error performing transaction, Timed out waiting for Task, null)
E/flutter (16297): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:547:7)
E/flutter (16297): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:279:18)
E/flutter (16297): <asynchronous suspension>
E/flutter (16297): #2 Firestore.runTransaction (file:///G:/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.7.3/lib/src/firestore.dart:115:10)
// here comes another <asynchronous suspension> followed by my code
这来自安卓。
最佳答案
这个错误有时是因为:
另一个错误是因为你没有:
正如 Firestore 文档所说:
“读操作必须先于写操作。”
https://firebase.google.com/docs/firestore/manage-data/transactions#transactions
关于firebase - Firestore 事务不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51051730/