addEntries method

  1. @override
void addEntries(
  1. Iterable<MapEntry<K, V>> newEntries
)
override

Adds all entries from the given iterable to this map.

Each entry in newEntries is added to this map, overwriting any existing entries with the same keys. Notifies subscribers after update.

Implementation

@override
void addEntries(Iterable<MapEntry<K, V>> newEntries) {
  bool needNotify = false;
  for (var entry in newEntries) {
    if (!needNotify &&
        (!peek.containsKey(entry.key) || peek[entry.key] != entry.value)) {
      needNotify = true;
    }
    peek[entry.key] = entry.value;
  }

  if (needNotify) {
    notify(true);
  }
}