fxEntries

Yields a Map's (key, value) pairs as records — the entry point for chaining over a Map.

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

Lecture

A Dart Map isn't an Iterable the way a List is, so there's no fx(someMap) directly. fxEntries is the bridge: it yields each key/value pair of the map as a (K, V) record, giving you a plain lazy Iterable you can wrap with fx() and chain like anything else. This mirrors FxTS's fxEntries, which does the same for a JS object.

Because the pairs are Dart records, you can destructure them directly in a for loop — for (final (key, value) in fxEntries(map)) — or access the positional fields .$1 (key) and .$2 (value) inside a map/filter callback when destructuring isn't convenient.

fxEntries is lazy like everything else here, but a Map's entries aren't infinite, so there's rarely a reason to bound it with take — it's more about turning a Map into something chainable than about controlling how much gets pulled.

Demo 1 · Basics

Demo 2 · Chaining over a Map

Wrap fxEntries(map) with fx() to filter and reshape a Map's contents:

Try it yourself

Exercise: turn a Map of scores into "name: PASS/FAIL" strings.

Related: fxKeys — just the keys of a Map · fxValues — just the values of a Map · fxFromEntries — the inverse: build a Map back from pairs · fx — the chain entries results feed into