matches
Curried isMatch: bind a pattern once, get back a reusable predicate.
Lecture
isMatch(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). matches(pattern) closes over
the pattern and returns exactly that shape:
matches(pattern)(target) == isMatch(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
curry 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 matches to build a predicate for {'active': true} and filter users with it.
isMatch — 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