如何使用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屋!