Я использую Firestore с флаттером и случайно пытаюсь установить, и мое приложение упало, я проверяю ошибку, я обнаружил, что
> E/AndroidRuntime(14541): java.lang.RuntimeException: An error occurred
> while executing doInBackground() E/AndroidRuntime(14541): at
> android.os.AsyncTask$4.done(AsyncTask.java:399)
> E/AndroidRuntime(14541): at
> java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
> E/AndroidRuntime(14541): at
> java.util.concurrent.FutureTask.setException(FutureTask.java:252)
> E/AndroidRuntime(14541): at
> java.util.concurrent.FutureTask.run(FutureTask.java:271)
> E/AndroidRuntime(14541): at
> android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
> E/AndroidRuntime(14541): at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
> E/AndroidRuntime(14541): at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
> E/AndroidRuntime(14541): at java.lang.Thread.run(Thread.java:919)
> E/AndroidRuntime(14541): Caused by: java.lang.AssertionError: INTERNAL
> ASSERTION FAILED: A transaction object cannot be used after its update
> callback has been invoked.
> E/AndroidRuntime(14541): at
> com.google.firebase.firestore.util.Assert.fail(com.google.firebase:firebase-firestore@@21.3.0:46)
> E/AndroidRuntime(14541): at
> com.google.firebase.firestore.util.Assert.hardAssert(com.google.firebase:firebase-firestore@@21.3.0:31)
> E/AndroidRuntime(14541): at
> com.google.firebase.firestore.core.Transaction.ensureCommitNotCalled(com.google.firebase:firebase-firestore@@21.3.0:246)
> E/AndroidRuntime(14541): at
> com.google.firebase.firestore.core.Transaction.write(com.google.firebase:firebase-firestore@@21.3.0:241)
> E/AndroidRuntime(14541): at
> com.google.firebase.firestore.core.Transaction.set(com.google.firebase:firebase-firestore@@21.3.0:105)
> E/AndroidRuntime(14541): at
> com.google.firebase.firestore.Transaction.set(com.google.firebase:firebase-firestore@@21.3.0:91)
> E/AndroidRuntime(14541): at
> com.google.firebase.firestore.Transaction.set(com.google.firebase:firebase-firestore@@21.3.0:67)
> E/AndroidRuntime(14541): at
> io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$7.doInBackground(CloudFirestorePlugin.java:688)
> E/AndroidRuntime(14541): at
> io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$7.doInBackground(CloudFirestorePlugin.java:682)
> E/AndroidRuntime(14541): at
> android.os.AsyncTask$3.call(AsyncTask.java:378)
> E/AndroidRuntime(14541): at
> java.util.concurrent.FutureTask.run(FutureTask.java:266)
> E/AndroidRuntime(14541): ... 4 more
Я обнаружил, когда я попытался выполнить transAction.set
inte rnet служба не работает, служба включена, но поле подключения, пока произошла ошибка,
мой код
await FireStoreHelper.firestore.runTransaction(
(transAction) async {
await transAction.set(
ItemsHelper(item.id).ItemsRef.document(),
{
'title':'title',
'price': 11.20
}
)