updateAll method
Updates all values.
Iterates over all entries in the map and updates them with the result
of invoking update.
final terrestrial = <int, String>{1: 'Mercury', 2: 'Venus', 3: 'Earth'};
terrestrial.updateAll((key, value) => value.toUpperCase());
print(terrestrial); // {1: MERCURY, 2: VENUS, 3: EARTH}
Implementation
@override
void updateAll(V Function(K key, V value) update) {
final List<MapEntry<K, V>> added = [];
final List<MapEntry<K, V>> removed = [];
for (final entry in _map.entries) {
V newValue = update(entry.key, entry.value);
if (_map.containsKey(entry.key)) {
removed.add(MapEntry(entry.key, _map[entry.key] as V));
}
added.add(MapEntry(entry.key, newValue));
}
_map.updateAll(update);
notifyListeners(MapChangeDetails<K, V>(added, removed));
}