Flutter Firestore use FieldValue.arrayRemove on a List of map and delete only by id

Viewed 86

i have a firestore db and inside my db, I have documents containing a list of map. This maps looks like that :

        {
          'gasCardCategory': "Refund",
          'payer': "John Doe",
          'amount': 45.6,
          'timestamp': "a timestamp",
          'participants': [{"1": "John Doe"}],
          'name': "Some name",
          'id': "die-342-dgh"
        }

So I have a field that is a list of map like that. I want to be able to use the FieldValue.arrayRemove but I don't want to pass all the values to delete the array because some of them can change (like the timestamp). And I would like to delete the whole map from the array by giving only the id field. (ID is unique)...

How do I do that without getting the full document, copying it to a list, find the id, delete it from the list and updating the whole list in firebase ?

(I think that the difference between the timestamps is due to an imprecision during converting Timestamp into DateTime and vice versa)

Thanks in advance

0 Answers
Related