Firebase集事务异常

Firebase集事务异常,firebase,flutter,google-cloud-firestore,Firebase,Flutter,Google Cloud Firestore,我在使用Flatter cloud\u Firestore包在Firestore事务中创建文档时遇到此异常: PlatformException(Error performing transaction, Every document read in a transaction must also be written., null) 代码如下: DocumentSnapshot postSnapshot = await tx.get(post.reference); await tx.se

我在使用Flatter cloud\u Firestore包在Firestore事务中创建文档时遇到此异常:

PlatformException(Error performing transaction, Every document read in a transaction must also be written., null)
代码如下:

DocumentSnapshot postSnapshot = await tx.get(post.reference);

await tx.set(Firestore.instance.collection('users').document(userId).collection('stars').
                 document(),docNew);
await tx.update(postSnapshot.reference, stockUpdate);
以下是例外情况的详细信息:

E/flutter ( 7157): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(Error performing transaction, Every document read in a transaction must also be written., null)
E/flutter ( 7157): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
E/flutter ( 7157): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
E/flutter ( 7157): <asynchronous suspension>
E/flutter ( 7157): #2      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:349:48)
E/flutter ( 7157): #3      MethodChannelFirestore.runTransaction (package:cloud_firestore_platform_interface/src/method_channel/method_channel_firestore.dart:123:10)
E/flutter ( 7157): #4      Firestore.runTransaction (package:cloud_firestore/src/firestore.dart:85:22)
E/flatter(7157):[错误:flatter/lib/ui/ui\u dart\u state.cc(157)]未处理的异常:PlatformException(执行事务时出错,事务中读取的每个文档也必须写入,null)
E/flatter(7157):#0 StandardMethodCodec.decodeEnvelope(包:flatter/src/services/message_编解码器。dart:569:7)
E/flatter(7157):#1 MethodChannel.invokeMethod(包:flatter/src/services/platform_channel.dart:321:33)
E/颤振(7157):
E/flatter(7157):#2 MethodChannel.invokeMapMethod(包:flatter/src/services/platform_channel.dart:349:48)
E/flatter(7157):#3 MethodChannelFirestore.runTransaction(包:cloud_-firestore_-platform_-interface/src/method_-channel/method_-channel_-firestore.dart:123:10)
E/flatter(7157):#4 Firestore.runTransaction(包:cloud_Firestore/src/Firestore.dart:85:22)
正如您在代码中看到的,我尝试在一个集合中创建文档,并在另一个文档中更新字段

有没有调试这个的提示?谢谢。

您也可以就此问题联系,他们会很乐意为您提供帮助。