.values

Anonymous contributor's avatar
Anonymous contributor
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: 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