删除Cloud Firestore文档中的特定字段时出错 [英] Error in deleting specific field in a cloud firestore document
本文介绍了删除Cloud Firestore文档中的特定字段时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用此处
Firestore.instance.collection('path').document('name').updateData({'Desc': FieldValue.delete()}).whenComplete((){
print('Field Deleted');
});
我正在使用
cloud_firestore: 0.13.2+1
但是,这会引发错误
[ERROR:flutter/lib/ui/ui_dart_state.cc(157)]未处理的异常:类型'MethodChannelFieldValue'不是'FieldValuePlatform'类型的子类型
[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: type 'MethodChannelFieldValue' is not a subtype of type 'FieldValuePlatform'
谁能告诉我如何正确删除字段
Can anyone tell me how to delete a field right way
推荐答案
您可以参考官方的 Firestore文档以获取有关如何删除字段的指导.
You may refer to the official Firestore documentation for guidance on how to delete fields.
var cityRef = db.collection('cities').doc('BJ');
// Remove the 'capital' field from the document
var removeCapital = cityRef.update({
capital: firebase.firestore.FieldValue.delete()
});
这篇关于删除Cloud Firestore文档中的特定字段时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文