mapValues<V2> method

Map<K, V2> mapValues<V2>(
  1. V2 mapper(
    1. V
    )
)

Returns a new map with values transformed by the mapper function.

Example:

{'a': 1, 'b': 2}.mapValues((v) => v * 2);
// {'a': 2, 'b': 4}

Implementation

Map<K, V2> mapValues<V2>(V2 Function(V) mapper) {
  return map((key, value) => MapEntry(key, mapper(value)));
}