fxNone

"Does nothing match?" — said as a universal, and answered at the first counter-example.

bool fxNone<A>(bool Function(A a) f, Iterable<A> iterable) Future<bool> fxNoneAsync<A>(FutureOr<bool> Function(A a) f, FxAsyncIterable<A> iterable) bool Fx<T>.none(bool Function(T a) f) // chain (sync) Future<bool> FxAsync<T>.none(FutureOr<bool> Function(T a) f) // chain (async)

Lecture

fxNone(f, xs) is true when f holds for no element. You could always write it as !fxSome(f, xs), and the answer is the same — but that reads as a negated existential ("it is not the case that some…"), and negation is where quantifier bugs live: the ! drifts to the wrong side of a &&, or gets dropped in a refactor. none says the rule the way you would state it.

It is the third quantifier beside every and any, and the three are tied together: none(f) is !any(f), it is every((x) => !f(x)), and it is atMost(0, f). Like any it short-circuits: the first match decides the answer (false) and the rest is never tested. An empty input has no counter-example, so it is true.

On the chain it is fx(xs).none(f); fxNoneAsync and fxAsync(…).none(f) accept a predicate that awaits and cancel upstream at the deciding match. Dart-native addition — FxTS has only every/some; Kotlin spells it none. It is unrelated to SingletonRaise.none() in the nullable builder, which short-circuits a raise scope; that one is a member, so neither name shadows the other.

Demo 1 · No match, empty input, early stop

Demo 2 · Three spellings, and async

Try it yourself

Exercise: drop the ! and say the rule directly.

Related: any — none is its negation · every — the universal quantifier · atMost — atMost(0, f) is none