invertMap<K, V> static method

Map<V, K> invertMap<K, V>(
  1. Map<K, V> map
)

Inverts a map (swaps keys and values).

Example:

Helpers.invertMap({'a': 1, 'b': 2}); // {1: 'a', 2: 'b'}

Implementation

static Map<V, K> invertMap<K, V>(Map<K, V> map) =>
    map.map((K key, V value) => MapEntry<V, K>(value, key));