How to delete a field in Firestore document with flutter

余生长醉 提交于 2020-04-10 09:29:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!