问题
I'm making a Flutter application.
But, I cannot delete a field in the Firestore document.
In another language I know to use FieldValue.delete() to delete a file in Firestorm document.
In Dart, How do I delete?
回答1:
Update Oct,2018: This is Now Possible:
In Order to delete a particular field from a cloud firestore document - make sure you are using Plugin version 0.8.0 or Above. Now a E.g If you have an Document having Field 'Desc' with contain some Text. In Order to Delete it.
Firestore.instance.collection('path').document('name').updateData({'Desc': FieldValue.delete()}).whenComplete((){
print('Field Deleted');
});
This will Delete 'Desc' Field from the Document 'name'
回答2:
I think this is currently impossible in standard, non hacky way. There is an open issue https://github.com/flutter/flutter/issues/13905 in Flutter which have to be resolved first.
来源:https://stackoverflow.com/questions/51633557/how-to-delete-a-field-in-firestore-document-with-flutter