I need some help updating the following nested data in flutter:
{
story: [
0: {
'views': {
// Updated DATA here
}
},
1: {
'views': {
// Or here
}
}
// Some other data
]
}
How can I updated data in firebase using above structure in Flutter?
我认为您在设置新值时需要一个 SetOptions 参数
FirebaseFirestore.instance.collection('...').document(id).set(newObject, SetOptions(merge:true);
使用这种结构,我相信您唯一的选择是先读取数据,在本地更新它,然后使用setData
或updateData
将其再次保存到 Firestore 中。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.