whereNot
Keeps every element a predicate returns false for — the mirror image of where.
Lecture
whereNot is implemented as
where((a) => !f(a), iterable) — it exists purely for
readability. list.whereNot(isInvalid) reads more naturally
than list.where((a) => !isInvalid(a)), especially once
the predicate already has a clear, positive name. whereNot
is the Dart-idiomatic name; fxdart also accepts the FxTS spelling
reject — they're the same operator. Pick whichever of
where/whereNot lets you avoid writing a
negation at the call site.
Everything about where's behavior carries over unchanged:
it's lazy, and the async form inherits whereAsync's
dedicated concurrent path, so .concurrent(n) genuinely
evaluates n predicates in parallel while still returning
results in original order.
Demo 1 · Basics
Demo 2 · Async, with concurrency
Try it yourself
Exercise: use whereNot to drop the 'info: ok'
lines, keeping only the errors.
filter — the function reject delegates to ·
compact — reject nulls specifically ·
uniq — remove duplicates ·
concurrent — parallel evaluation