map.get($map, $key, $keys...) returns the value associated with a key. With one key it reads the top level. With more keys it walks nested maps and returns the value at the last key. Load it with @use "sass:map" on Dart Sass 1.23+ (nested multi-key paths need a current Dart Sass release). Legacy global name: map-get.
Reads a value by key or nested path without changing the map.
Missing keys return null — not an error.
Nested paths unlock design-token maps in Dart Sass.
Prefer map.get over deprecated global map-get.
One line: when you need a map value, call map.get($map, $key) or map.get($map, $path...).
Practice
Compile Notes
Practical checklist:
checklist.txt
1. @use "sass:map"
2. Use map.get for reads; map.set / merge for writes
3. Nested tokens: map.get($map, group, token)
4. Guard missing keys with has-key or `or`
5. Avoid global map-get in new code
Frequently Asked Questions
map.get($map, $key, $keys...) returns the value for a key. With one key it reads the top level. With more keys (Dart Sass) it walks nested maps and returns the value at the last key.
It returns null. That is not an error. Use map.has-key() when you need a true/false check, or combine with or for a default: map.get($map, $key) or $default.
Yes. map-get($map, $key) is the older global name, but Dart Sass deprecates global built-ins toward Sass 3.0. Prefer map.get after @use "sass:map". Nested key paths need the module API.
map.get returns the stored value (or null). map.has-key returns true or false for whether the key exists—useful when the real value might be null, 0, or false.
Two-argument get works widely via map.get / map-get. Passing multiple keys for nested lookup is Dart Sass only. Prefer current Dart Sass for design-system maps.
No. It only reads. Use map.set, map.merge, or map.deep-merge when you need a new map with updates.