Dart Map

Dart Map

The Map object is a simple key/value pair. Keys and values in a map may be of any type.

  • You can create a map in Dart using the Map constructor or map literals ({}).

  • To declare a Map using a Map constructor, we have two steps. First, declare the map and second, initialize the map .

  Map<String, int> map = {
      'apple': 5,
      'banana': 7,
      'orange': 8
    };