gpt4 book ai didi

firebase - "java.lang.IllegalArgumentException: Unsupported value"访问FireStore子集合异常

转载 作者:IT王子 更新时间:2023-10-29 07:06:58 25 4
gpt4 key购买 nike

我有以下 Firestore 集合。

enter image description here

添加“用户”作为对“上传”文档的引用。

这是我使用的代码,当我没有那个“引用”对象时它工作正常。

return new StreamBuilder<QuerySnapshot>(
stream: Firestore.instance
.collection('uploads')
.where('type', isEqualTo: type)
.snapshots,
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
process(snapshot.data.documents);
});

但是,当我添加此用户引用时,Flutter 出现以下异常。

E/AndroidRuntime(11714): java.lang.IllegalArgumentException: Unsupported value: com.google.firebase.firestore.DocumentReference@147888c5
E/AndroidRuntime(11714): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:260)
E/AndroidRuntime(11714): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:257)
E/AndroidRuntime(11714): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:257)
E/AndroidRuntime(11714): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:249)
E/AndroidRuntime(11714): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:257)
E/AndroidRuntime(11714): at io.flutter.plugin.common.StandardMethodCodec.encodeMethodCall(StandardMethodCodec.java:31)
E/AndroidRuntime(11714): at io.flutter.plugin.common.MethodChannel.invokeMethod(MethodChannel.java:82)
E/AndroidRuntime(11714): at io.flutter.plugin.common.MethodChannel.invokeMethod(MethodChannel.java:69)
E/AndroidRuntime(11714): at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$EventObserver.onEvent(CloudFirestorePlugin.java:207)
E/AndroidRuntime(11714): at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$EventObserver.onEvent(CloudFirestorePlugin.java:190)
E/AndroidRuntime(11714): at com.google.firebase.firestore.zzi.onEvent(Unknown Source)
E/AndroidRuntime(11714): at com.google.android.gms.internal.zzevc.zza(Unknown Source)
E/AndroidRuntime(11714): at com.google.android.gms.internal.zzevd.run(Unknown Source)
E/AndroidRuntime(11714): at android.os.Handler.handleCallback(Handler.java:751)
E/AndroidRuntime(11714): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(11714): at android.os.Looper.loop(Looper.java:154)
E/AndroidRuntime(11714): at android.app.ActivityThread.main(ActivityThread.java:6176)
E/AndroidRuntime(11714): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(11714): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
E/AndroidRuntime(11714): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)

当我将“引用”类型转换为其他类型时,它起作用了。

问题:

如何修改我的代码以获取上传及其用户引用详细信息?

最佳答案

其实这个问题我已经提过了here ,它在他们的 github 上仍然显示为开放。在这个阶段,我认为你不能使用 reference 类型。也许现在尝试使用 ID

关于firebase - "java.lang.IllegalArgumentException: Unsupported value"访问FireStore子集合异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48995255/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com