Dart .values

Sriparno08's avatar
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.

  • 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

Syntax

newMap.values
  • newMap: The Map to be iterated.

Example

The following example demonstrates the usage of the .values property:

void main() {
// Creating a Map
var players = {'Cricket': 'Sam', 'Football': 'Chris', 'Tennis': 'Roger'};
// Extracting all the values in the Map
print(players.values);
}

The above code produces the following output:

(Sam, Chris, Roger)

All contributors

Contribute to 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