0

I trying to delete specific field in firebase firestore uisng flutter if the user enter one of the serial code is this collection. Here is my collection for example if the user enter rhdrVjVxcnCCj55c Serial 1 should be empty. collection and fields

I treid this but dose not work

 CollectionReference sCodes = FirebaseFirestore.instance
              .collection('Register New System ( serial code )');
          sCodes
              .doc('Serial Codes')
              .update({_serialCodeController.text: FieldValue.delete()})
              .then((value) => print("User's Property Deleted"))
              .catchError(
                  (error) => print("Failed to delete user's property: $error"));
Mahmoud
  • 11
  • 2
  • We can't see the value of `_serialCodeController.text`, so we don't know if you're providing the value you expect. Try hard coding the right value, or logging the value to verify it is what you expect. – Doug Stevenson Apr 11 '22 at 19:47
  • Yes I do entered the correct value to test, I will upload full code so you can know what is going on – Mahmoud Apr 11 '22 at 19:50
  • The information you provide should be reproducible by anyone. There should be no question how the code runs and the values of any variables. It's better if you don't have any variables at all. Please read: https://stackoverflow.com/help/minimal-reproducible-example – Doug Stevenson Apr 11 '22 at 20:07
  • Please provide enough code so others can better understand or reproduce the problem. – Community Apr 11 '22 at 20:11
  • Thanks for help, I was trying to post full code but stackoverflow rejected but I did it so Thanks for help all of you – Mahmoud Apr 11 '22 at 20:26

0 Answers0