mapKeys<K2> method
Transforms all the keys in the map by applying a transform function.
Example:
final map = <int, int>{1: 1, 2: 2, 3: 3};
final transformed = map.mapKeys((key) => key.toString());
print(transformed); // Output: <String, int>{'1': 1, '2': 2, '3': 3}
Implementation
Map<K2, V> mapKeys<K2>(K2 Function(K key) transform) =>
Map<K2, V>.fromEntries(
entries.map((e) => MapEntry(transform(e.key), e.value)),
);