not
Boolean negation as a function you can pass around.
Lecture
not does exactly what !a does — it just does it
as a first-class function, so it can be passed where a
bool Function(bool) is expected instead of you writing
(b) => !b yourself. FxTS's not works on
JavaScript "truthy" values of any type; Dart has no implicit truthiness,
so the Dart port only accepts an actual bool.
Because its signature is bool -> bool, not
doubles as a predicate itself wherever the element type is already
bool — see some/every in Demo 2.
For negating an arbitrary predicate over some other type, use
negate instead.
Demo 1 · Basics
Demo 2 · As a predicate over booleans
not is itself a bool Function(bool), so it
plugs straight into some/every without wrapping:
Try it yourself
Exercise: use not to build the list of "still pending"
flags from a list of "done" flags.