predicates
A small family of type/value checks, kept around as tear-off-friendly functions for filter, takeWhile, and friends.
Lecture
In everyday Dart you'd just write a is String — that's
idiomatic, and nothing here replaces it. These functions exist for one
specific reason: Dart's is operator can't be torn off as a
first-class function value, but filter, takeWhile,
find, and friends all want a bool Function(A).
filter(isString, mixedList) reads better than
filter((a) => a is String, mixedList), and that's the whole
point of this page.
isNil is a straight port of FxTS's "is null or
undefined" check — since Dart collapses both into
null, it's byte-for-byte identical to isNull.
Three more names exist purely for FxTS parity and are marked
@Deprecated: isUndefined (there's no
undefined in Dart, so it's just isNull),
isArray (JS Array → Dart List, so
it's isList), and isObject (JS plain object →
Dart Map, so it's isMap). Reach for the
non-deprecated name in new code; the aliases are there so ported call
sites still compile.
Demo 1 · Filter-friendly tear-offs
Demo 2 · isNil and the deprecated aliases
Try it yourself
Exercise: use isNotNull to filter the null out of row.