mapValues<V2> method

Map<K, V2> mapValues<V2>(
  1. V2 transform(
    1. K key,
    2. V value
    )
)

Transforms the values of the map.

Example:

print({'a': 1}.mapValues((k, v) => v + 1)); // {'a': 2}

Implementation

Map<K, V2> mapValues<V2>(V2 Function(K key, V value) transform) {
  return Map.fromEntries(entries.map((e) => MapEntry(e.key, transform(e.key, e.value))));
}