I have the following code which is supposed to update my address record in firebase. However, instead of updating, its adding new fields.
Here's the code:
Future<void> updateAddress (Address address) async{
final url = 'https://m&m.firebaseio.com/address/$userId.json?auth=$authToken';
await http.patch(url, body:json.encode({
'phoneNumber':address.phoneNumber,
'name':address.name,
'details':address.details,
'alternatePhone':address.alternatePhone
}));
_items.first = address;
notifyListeners();
}
Here's how it looks after I execute the update function:
