Dart – Map

Mapping all elements in a map. Here I just swapped the key and the value of the map.

Map<String, String> myMap = {'1': 'one', '2': 'two', '3': 'three'};
  
Map<String, String> myMapMapped;
myMapMapped = myMap.map((key, value) =>
    MapEntry<String, String>(value, key));
Map<String, String> myMap = {'1': 'one', '2': 'two', '3': 'three'};
  
Map<String, String> myMapMapped;
myMapMapped = myMap.map((key, value) =>
    MapEntry<String, String>(value, key));