fxKeys

The keys of a Map, as a plain lazy Iterable — ready to wrap in fx() and chain.

Iterable<K> fxKeys<K, V>(Map<K, V> map)

Lecture

fxKeys(map) is a thin, FxTS-flavored wrapper around Dart's own map.keys — it exists mainly so the object-function vocabulary (fxEntries, fxKeys, fxValues) reads consistently and slots straight into fx(). Dart's Map.keys is already a lazy view, so fxKeys doesn't add any extra buffering — it just hands you the same lazy Iterable<K>.

Reach for it when you want to filter, transform, or collect a Map's key set using the rest of the chain vocabulary, rather than reaching for .where()/.toList() on map.keys directly — the two are equivalent, but fx(fxKeys(map)) reads naturally next to fx(fxValues(map)) and fx(fxEntries(map)).

If you need the keys and values together, use fxEntries instead — pulling fxKeys and fxValues separately does not guarantee they line up if the underlying map were mutated between the two calls.

Demo 1 · Basics

Demo 2 · Filtering a Map by its keys

Try it yourself

Exercise: use fxKeys and sort to get an alphabetically sorted list of item names.

Related: fxEntries — keys and values paired together · fxValues — the values of a Map · fxPick — build a new Map from a subset of keys · fx — the chain keys results feed into