update function

Future<void> update(
  1. String path,
  2. Map<String, Object?> value
)

Update a node data

Writes multiple values to the Database at once.

The values argument contains multiple property-value pairs that will be written to the Database together. Each child property can either be a simple property (for example, "name") or a relative path (for example, "name/first") from the current location to the data to update.

As opposed to the set method, update can be use to selectively update only the referenced properties at the current location (instead of replacing all the child properties at the current location).

Note that modifying data with update will cancel any pending transactions at that location, so extreme care should be taken if mixing update and runTransaction to modify the same data.

Passing null to a Map value in update will remove the value at the specified location.

Implementation

Future<void> update(String path, Map<String, Object?> value) async {
  await FirebaseDatabase.instance.ref(path).update(value);
}