Reputation: 28906
I'm using this code from here
Firestore.instance.collection('path').document('name').updateData({'Desc': FieldValue.delete()}).whenComplete((){
print('Field Deleted');
});
I'm using
cloud_firestore: 0.13.2+1
However, this throws an error
[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
Upvotes: 3
Views: 518
Reputation: 28906
With cloud_firestore: ^2.2.0
this seem to working:
FirebaseFirestore.instance
.collection('path')
.doc('name')
.update({'desc': FieldValue.delete()});
Upvotes: 1