concept literal map in category dart

appears as: literal maps, literal map
Dart in Action

This is an excerpt from Manning's book Dart in Action.

We’ll start by using the built-in collection classes, such as List and Map, which allow you to manipulate lists of data. By using generic types, you can help make accessing your collections type-safe and benefit from additional validations from the type checker. You’ll use the indexer syntax to access elements directly in lists and maps and discover how to build literal maps and lists from known, preexisting values. We’ll also look at the JavaScript Object Notation (JSON) methods to convert maps into strings and back to maps.

Creating literal maps

A map is a set of key/value pairs, and you can define a literal map by using curly braces containing a comma-separated list of these "key":"value" pairs. You access the map elements by using the key name in an indexer on the map:

When specifying a literal map, values can be any object:

sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest