any
True when at least one element satisfies a predicate — false for an empty iterable.
Lecture
any is the Dart-idiomatic name; fxdart also accepts the
FxTS spelling some — they're the same operator. It's
every's mirror image: it scans left to
right and short-circuits the moment it finds a match, returning
true right away. If it never finds one — including on an
empty iterable, which is the opposite vacuous case from
every — it returns false only after checking
everything.
On a sync chain, .any(f) comes straight from Dart's
Iterable — Fx inherits it — so it needs no
special definition. The async chain and the data-first
any(f, iterable) form are supplied by fxdart, and the FxTS
spelling some still works in every position.
Demo 1 · Basics & short-circuiting
Demo 2 · Async
Try it yourself
Exercise: use any to check if anything in the cart costs more than 10.
every — the "all of them" counterpart ·
includes — a specialization of any ·
find — get the matching element, not just a bool ·
predicates — ready-made predicates to pair with any