How to access and update a specific field in flutter fireStore Database?
Future<void> updateMyOrder(String username, String status) => FirebaseFirestore.instance
.collection("checkout")
.doc(username)
.update({'cart.condition': status});
How to access and update a specific field in flutter fireStore Database?
Future<void> updateMyOrder(String username, String status) => FirebaseFirestore.instance
.collection("checkout")
.doc(username)
.update({'cart.condition': status});
There is no field cart.condition
in the document you show, as that'd be a map-field called cart
with a subfield called condition
in it.
I think you're trying to update a field of an array item, which is not possible in Firestore. The only array operations are array-union, which adds a new item to an array if it's not already in there, and array-remove. Both of these require that you specify the entire array item, and not just one/some fields of it.
The only way to update a field in a Firestore document is to: