fxMatches

Curried fxIsMatch: bind a pattern once, get back a reusable predicate.

bool Function(Object? target) fxMatches(Object? pattern)

Lecture

fxIsMatch(target, pattern) needs both arguments up front, which makes it awkward to hand to filter, find, every, or anywhere else that wants a single-argument bool Function(A). fxMatches(pattern) closes over the pattern and returns exactly that shape: fxMatches(pattern)(target) == fxIsMatch(target, pattern). Build the predicate once, reuse it across a whole pipeline.

This is FxDart's version of currying for a two-argument function where Dart can't infer a general curry — see the deprecated top-level fxCurry if you're curious why a generic version doesn't exist — but a purpose-built curried form like this one works great.

Demo 1 · Basics

Demo 2 · Dropping straight into filter/find

Try it yourself

Exercise: use fxMatches to build a predicate for {'active': true} and filter users with it.

Related: fxIsMatch — the two-argument function this curries · filter — the most common place to plug this in · find — grab just the first match · predicates — more ready-made, filter-friendly checks