props
Returns the values of several keys in a Map, as a List.
List<V?> props<K, V>(Iterable<K> propKeys, Map<K, V> map)
Lecture
props is prop applied to several keys at once,
in order: give it a list of keys and a map, and get back a
List<V?> with one slot per requested key. Unlike
pick, a missing key does not get
dropped from the result — it becomes null in that
position, so the output List always has the same length as
propKeys. That positional guarantee is what makes it pair
so well with Dart's list-destructuring pattern.
Demo 1 · Basics
Demo 2 · Destructuring the result
Try it yourself
Exercise: use props to pull ['first', 'last'] out of row as a List.
Related:
prop — a single key at a time ·
pick — the Map-shaped equivalent ·
fromEntries — build a Map back up ·
evolve — transform selected values in place