3

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

iDecode
  • 22,623
  • 19
  • 99
  • 186

1 Answers1

1

With cloud_firestore: ^2.2.0 this seem to working:

FirebaseFirestore.instance 
    .collection('path')
    .doc('name')
    .update({'desc': FieldValue.delete()});
iDecode
  • 22,623
  • 19
  • 99
  • 186