firebase错误:数据将其复制为自我Intade更新子值
数据不断复制数据以更新数据,在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 :
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这看起来像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 thedayliRecords
[sic] node..