mapEntries<K2, V2> method

Map<K2, V2> mapEntries<K2, V2>(
  1. MapEntry<K2, V2> transform(
    1. K key,
    2. V value
    )
)

Maps the map to a new map with transformed keys and values.

Example:

{'a': 1, 'b': 2}.mapEntries((k, v) => MapEntry(k.toUpperCase(), v * 2));
// {'A': 2, 'B': 4}

Implementation

Map<K2, V2> mapEntries<K2, V2>(
  MapEntry<K2, V2> Function(K key, V value) transform,
) {
  return map((key, value) => transform(key, value));
}