invert method
Inverts the map, swapping keys and values.
Note: If multiple keys have the same value, only one will be preserved.
Example:
{'a': 1, 'b': 2}.invert(); // {1: 'a', 2: 'b'}
Implementation
Map<V, K> invert() {
return map((key, value) => MapEntry(value, key));
}