如何解决错误路径中不能包含//。 Firestore抖动错误 [英] How to solve error Paths must not contain // in them. Firestore flutter error

查看:75
本文介绍了如何解决错误路径中不能包含//。 Firestore抖动错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的路径中没有包含//,但是仍然从Firestore收到错误消息,提示 路径中不得包含//

I am not including // in my path.But still i am getting error from firestore that Paths must not contain // in them

onPressed: (){
    opencheckout();
    setState(() {
        _firestore.collection('userss').document(uid)
            .collection('OrdersSuccess').add({
                "name":product.name,
                "original":product.original,
                "Quantity":product.Quantity,
                "image":product.image,
            });
    });
};

调试控制台消息

Debug console Message

E/MethodChannel#plugins.flutter.io/cloud_firestore(12572): java.lang.IllegalArgumentException: Invalid path (userss//OrdersSuccess/Iy4M9nYayqCAk0EcCKEB). Paths must not contain // in them.
E/MethodChannel#plugins.flutter.io/cloud_firestore(12572):  at com.google.firebase.firestore.model.ResourcePath.fromString(com.google.firebase:firebase-firestore@@21.3.0:45)


推荐答案

请仔细阅读错误消息:

Read the error message carefully:


无效路径(users // OrdersSuccess / Iy4M9nYayqCAk0EcCKEB)。路径中不能包含//。

Invalid path (userss//OrdersSuccess/Iy4M9nYayqCAk0EcCKEB). Paths must not contain // in them.

以下是查询:

_firestore.collection('userss').document(uid).collection('OrdersSuccess')

看起来您的 uid 可能是一个空字符串,这导致周围的两个斜杠折叠成 // 。因此,使用调试器或打印 uid 并确保它包含您期望的内容。

It looks like your uid might be an empty string, which causes the two surrounding slashes to collapse into //. So, check uid by using a debugger or printing it, and make sure it contains what you expect.

这篇关于如何解决错误路径中不能包含//。 Firestore抖动错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆