patch method

bool patch(
  1. String route,
  2. TId id,
  3. Map<String, dynamic> updates
)

Partially updates a value for a given route and ID.

  • route: The route where the value should be partially updated.
  • id: The ID associated with the value.
  • updates: A map of updates to be applied to the existing value.

Returns:

  • true if the value was partially updated successfully, or false if the route, ID, or value type was not suitable.

Implementation

bool patch(String route, TId id, Map<String, dynamic> updates) {
  if (_data.containsKey(route) && _data[route]!.containsKey(id)) {
    if (_data[route]![id] is Map) {
      (_data[route]![id] as Map<String, dynamic>).addAll(updates);
      return true;
    }
  }
  return false;
}