Эта страница ещё не переведена, поэтому показана на английском. Помогите с переводом

whereNot

Keeps every element a predicate returns false for — the mirror image of where.

Iterable<A> whereNot<A>(bool Function(A a) f, Iterable<A> iterable) FxAsyncIterable<A> whereNotAsync<A>(FutureOr<bool> Function(A a) f, FxAsyncIterable<A> iterable) Fx<T> Fx.whereNot(bool Function(T a) f) // chain FxAsync<T> FxAsync.whereNot(FutureOr<bool> Function(T a) f) Iterable<A> reject<A>(bool Function(A a) f, Iterable<A> iterable) // FxTS alias

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.

Related: filter — the function reject delegates to · compact — reject nulls specifically · uniq — remove duplicates · concurrent — parallel evaluation