updateAll method

  1. @override
void updateAll(
  1. V update(
    1. K key,
    2. V value
    )
)
override

Updates all values in the map.

Calls update for each key-value pair and updates the value with the returned result. Notifies subscribers after all updates.

Implementation

@override
void updateAll(V Function(K key, V value) update) {
  bool needNotify = false;
  for (var key in peek.keys) {
    final oldValue = peek[key];
    final newValue = peek[key] = update(key, oldValue as V);
    if (!needNotify && oldValue != newValue) {
      needNotify = true;
    }
  }
  if (needNotify) {
    notify();
  }
}