Programming in Dart: Control Flow & Collections

May 3 2022 Dart 2.15, DartPad, DartPad

Part 2: More Collections

12. Create & Populate Maps

Episode complete

Play next episode

Next
Save for later
About this episode
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 11. Introduction Next episode: 13. Access & Work with Maps

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

You can unlock the rest of this video course, and our entire catalogue of books and videos, with a kodeco.com Professional subscription.

You’re ready to learn about another extremely useful collection type in Dart: maps.

var emptyMap = {};
var anotherMap = Map<String, int>();
var namesAndPets = { 'Ron': '🐀 Rat', 'Rincewind': '🛄 Luggage', 'Thor': '🔨 Hammer', 'Goku': '☁️ Flying Nimbus' }; 
print(namesAndPets)
namesAndPets['🐶 Cosmos'] = 'Brian';
namesAndPets['Ron'] = '🦉 Owl';
print(namesAndPets)