更新地图字段-颤振

问题描述 投票:1回答:2

如何更新isVerified(布尔值)字段的数据。个人信息是地图包含地址,然后是isVerified。

enter image description here

firebase flutter dart google-cloud-firestore
2个回答
2
投票

要更新isVerified,您必须执行以下操作:

Firestore.instance.collection("collection Name").document("documentId").updateData({
    "Personal Info.address.isVerified": true,
  }).then((_) {
    print("success!");
  });

2
投票

由于您未提供您的藏书或文件名,我将组成一个

因此,假设每次单击按钮时,值都应更改为true

CollectionReference humanCollection = Firestore.instance.collection("collection Name");
//This is the button
FlatButton(
onPressed: () => changeValue();
 child : Container(
   Text : 'Change Value'
)
),

//This is the function

changeValue(){

humanCollection
        .document(currentHuman.id)//put the document name here
        .updateData({
          'Personal Info.address.isVerified' : true,
         });
}
© www.soinside.com 2019 - 2024. All rights reserved.