.keys
Anonymous contributor
Published Mar 12, 2024
Contribute to Docs
In Dart, the .keys
property returns an iterable collection containing all the keys in a map.
Syntax
myMap.keys
myMap
: The map name that needs to be searched.
Example
The following example displays the usage of the .keys
property:
void main() {Map<String, String> adventurers = {'001': 'Alice the Archer','002': 'Bob the Barbarian','003': 'Charlie the Cleric'};for (var id in adventurers.keys) {print(id);}}
The above example produces the following output:
001002003
All contributors
- Anonymous contributor
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.