Iterating Entries, Keys, and Values
Loop a map and use putIfAbsent.
Looping a Map
Sometimes you need to visit every pair in a Map. Dart gives you several clean ways to walk through it. 🚶
Just the Keys
The keys property gives an iterable of every key. Loop it when you only care about the labels.
var m = {'a': 1, 'b': 2};
for (var k in m.keys) {
print(k);
}All lessons in this course
- Sets and Guaranteed Uniqueness
- Set Operations: union, intersection, difference
- Maps as Key-Value Stores
- Iterating Entries, Keys, and Values