Using collection literals

List, set, and map literals can be parameterized. Parameterized literals arejust like the literals you’ve already seen, except that you add<type> (for lists and sets) or<keyType, valueType> (for maps)before the opening bracket. Here is an example of using typed literals:

  1. var names = <String>['Seth', 'Kathy', 'Lars'];
  2. var uniqueNames = <String>{'Seth', 'Kathy', 'Lars'};
  3. var pages = <String, String>{
  4. 'index.html': 'Homepage',
  5. 'robots.txt': 'Hints for web robots',
  6. 'humans.txt': 'We are people, not machines'
  7. };