mapKeys<K2> method

Map<K2, V> mapKeys<K2>(
  1. K2 transform(
    1. K key,
    2. V value
    )
)

Returns a new map with transformed keys.

Implementation

Map<K2, V> mapKeys<K2>(K2 Function(K key, V value) transform) {
  final output = <K2, V>{};
  forEach((key, value) {
    output[transform(key, value)] = value;
  });
  return output;
}