firebase错误:数据将其复制为自我Intade更新子值

发布于 2025-02-11 09:14:49 字数 664 浏览 0 评论 0原文

数据不断复制数据以更新数据,在Flutter 3工作正常之前,没有任何问题, 我的代码

 var dailydata = database_Reference
    .child("users")
    .child(SharedPref.userUid!)
    .child("dayliRecords")
    .child(date);

  dailydata.set({
  "name": SharedPref.user_id,
  "router_bssid": thisWifiObject!.bssId,
  "date": dailyWorkTime,
  "startingTime": startingTime,
  "endingTime": endingTime,
  "totalWorkTime": SharedPref.hours == 0 ? 0 : SharedPref.hours,
  "percent": SharedPref.percent == 0 ? 0.0 : SharedPref.percent,
  "connectedfrom": thisWifiObject!.macAddress,
});

和firebase中:

“在此处输入图像说明”

the data keep duplicating instade of updating the data , before flutter 3 was working fine without any problems,
my code

 var dailydata = database_Reference
    .child("users")
    .child(SharedPref.userUid!)
    .child("dayliRecords")
    .child(date);

  dailydata.set({
  "name": SharedPref.user_id,
  "router_bssid": thisWifiObject!.bssId,
  "date": dailyWorkTime,
  "startingTime": startingTime,
  "endingTime": endingTime,
  "totalWorkTime": SharedPref.hours == 0 ? 0 : SharedPref.hours,
  "percent": SharedPref.percent == 0 ? 0.0 : SharedPref.percent,
  "connectedfrom": thisWifiObject!.macAddress,
});

and in the firebase :

enter image description here

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

娇女薄笑 2025-02-18 09:14:49

这看起来像Firebase控制台中的一个工件,该工具显示set操作是删除该节点的旧值(以红色)的旧值,然后添加新值(绿色)。

如果确实是正在发生的事情,则UI应在动画完成后显示正确的最终状态。在API级别上,这根本不应影响行为,它应该为daylirecords [sic> [sic> sic] node。

This looks like an artifact in the Firebase console, which shows the set operation as removing the old value of that node (in red) and then adding the new value (in green).

If that is indeed what is happening, the UI should show the correct final state after the animations are done. And on the API level this should not affect the behavior at all, and it should fire a child_changed event for the dayliRecords [sic] node..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文