invert method

Map<V, K> invert()

Inverts the map by swapping its keys and values. Assumes that the values are unique.

Example:

var map = {'first': 'John', 'second': 'Doe'};
print(map.invert()); // Output: {'John': 'first', 'Doe': 'second'}

Implementation

Map<V, K> invert() => map((key, value) => MapEntry(value, key));