如何用flutter删除Firestore文档中的字段 [英] How to delete a field in Firestore document with flutter
问题描述
我正在制作Flutter应用程序。
I'm making a Flutter application.
但是,我无法删除Firestore文档中的字段。
我知道用另一种语言使用 FieldValue.delete()
删除Firestorm文档中的文件。
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.
在Dart中,如何删除?
In Dart, How do I delete?
推荐答案
更新2018年10月:可能:
要从Cloud Firestore文档中删除特定字段,请确保您使用的是插件版本0.8.0或更高版本。现在,例如您有一个文档,其字段 Desc包含一些文本。为了删除它。
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 a document having a field 'Desc' with contain some Text. In Order to Delete it.
Firestore.instance.collection('path').document('name').update({'Desc': FieldValue.delete()}).whenComplete((){
print('Field Deleted');
});
这将从文档名称中删除 Desc字段
This will Delete 'Desc' Field from the Document 'name'
这篇关于如何用flutter删除Firestore文档中的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!