我想在中的云FireStore中创建/更新一组存储在嵌套数组方法中的数据.

enter image description here I want to define the nested array to be in a Map<String, dynamic> method like this.

推荐答案

首先,您必须创建类别模型的实例,然后根据您的需求更改值

100

 Categories c =  categories; // here assign your exiting data of categories
     c.copyWith(flavor : ["hello","world"]);

          await FirebaseFirestore.instance
          .collection('user')
          .doc(FirebaseAuth.instance.currentUser?.uid)
          .collection('todos')
          .doc(map["collectionId"])
          .update(FieldValue.arrayUnion(c)))

Flutter相关问答推荐

如何从模型列表中生成DropdownButtonFormField?

从Flutter应用程序解释蓝牙BLE数据:了解Sylvania压力值

SingleChildScrollView正在将Container的高度限制为子对象,尽管使用了Expanded Inside Row()

如何在Flutter 中共享选定文本

如何在不注销的情况下刷新Firebase身份验证用户

无法构建AndroidBundle 包或iOS等

Ffltter Firebase向用户添加公司

如何在Flutter中制作弯曲文本

Flutter 未处理的异常 - 对 null 值使用 Null 判断运算符

Flutter开发中,如何通过'nfc_manager'插件在Android设备上避免默认的New Tag Scanned弹出窗口?

Flutter列顶部和底部出现不必要的边距问题

ListView 后台可见

我的第一个 flutter 项目出错,启动时为空值?

Freezed+BLoc 如何从 BLoc Listener 查看当前状态和特定状态的变量

如何使用 riverpod_annotation 创建非自动处置提供程序?

Flutterfire Configure - 未处理的异常和没有 firebase 初始化

为什么将 bloc 提供程序放在单独的文件/类中会引发错误?

如何将金钱格式化为数以百万计的Flutter 动?

Flutter Web Responsiveness 效率不高

未处理的异常:FileSystemException:无法打开文件,路径 = 'assets/res.zip'(操作系统错误:没有这样的文件或目录,errno = 2)