flip method

Map<V, K> flip()
  • swaps the collection's keys with their corresponding values

Implementation

Map<V, K> flip() {
  final Map<V, K> flippedMap = {};
  forEach((key, value) {
    flippedMap[value] = key;
  });
  return flippedMap;
}