Flutter Arrayunion:Getter' iterator'被称为null

发布于 2025-02-07 00:02:47 字数 431 浏览 1 评论 0原文

我有一个list< string>(uploadedfileurls1)和string(uploadedfileurl2),我将我添加到firebase中的数组中。每个都可以被填充,一个空或两个。如果两者都填充,或者仅填充了载荷fileurls1(uploadedfileurl2是null),则似乎有效。但是,如果uploadedfileurls1(list< string>)为null,我会遇到此错误:

NoSuchMethodError: The getter 'iterator' was called on null.

不幸的是,似乎不容易检查此值是否为null。如果是无效的,我不想写任何东西给firebase。有什么建议吗?

I have a List<String> (uploadedFileUrls1) and String (uploadedFileUrl2) that I am adding to an array in Firebase. Each can be populated, one null, or both null. It seems to work if both are populated, or if just the loadedFileUrls1 is populated (uploadedFileUrl2 is null). However, if uploadedFileUrls1 (List<String>) is null, I am getting this error:

NoSuchMethodError: The getter 'iterator' was called on null.

Unfortunately, there doesn't seem to be an easy to check if this value is null or not. If it is null, I do not want to write anything to Firebase. Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文