Dart .values
Published Jul 17, 2024
Contribute to Docs
In Dart, the .values property is used to return an iterable object containing all the values in a specified Map.
Syntax
newMap.values
newMap: TheMapto be iterated.
Example
The following example demonstrates the usage of the .values property:
void main() {// Creating a Mapvar players = {'Cricket': 'Sam', 'Football': 'Chris', 'Tennis': 'Roger'};// Extracting all the values in the Mapprint(players.values);}
The above code produces the following output:
(Sam, Chris, Roger)
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.
Learn Dart on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours