问题
How to update data of isVerified (Boolean) field. Personal Info is Map contains address and then isVerified.
回答1:
To update isVerified
, you have to do the following:
Firestore.instance.collection("collection Name").document("documentId").updateData({
"Personal Info.address.isVerified": true,
}).then((_) {
print("success!");
});
回答2:
Since you did not provide your collection or document name I would just form one
So lets assume every time we click a button the value should be changed to 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,
});
}
来源:https://stackoverflow.com/questions/62214831/update-the-map-field-flutter