mappedValues<R> method
Maps the values of the map using the provided function f.
Example usage:
void main() {
Map<String, int> scores = {
'John': 80,
'Alice': 90,
'Bob': 75,
'Eve': 85,
};
Map<String, int> squaredValues = scores.mappedValues((value) => value * value);
print(squaredValues); // Output: {John: 6400, Alice: 8100, Bob: 5625, Eve: 7225}
}
Implementation
Map<K, R> mappedValues<R>(R Function(V value) f) => map((key, value) => MapEntry(key, f(value)));