Error in deleting specific field in a cloud firestore document

Viewed 454

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

1 Answers

With cloud_firestore: ^2.2.0 this seem to working:

FirebaseFirestore.instance 
    .collection('path')
    .doc('name')
    .update({'desc': FieldValue.delete()});
Related