mapValues<K, V, V2> static method

Map<K, V2> mapValues<K, V, V2>(
  1. Map<K, V> map,
  2. V2 fn(
    1. V
    )
)

Returns a new map with each value transformed by fn.

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

Implementation

static Map<K, V2> mapValues<K, V, V2>(Map<K, V> map, V2 Function(V) fn) => {
  for (final e in map.entries) e.key: fn(e.value),
};