mapValues<K, V1, V2> function

Map<K, V2> mapValues<K, V1, V2>(
  1. Map<K, V1> map,
  2. V2 transform(
    1. V1 value
    )
)

Transforms values in a Map

map Source map transform Value transformation function

Implementation

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