MaybeNumExtension<T extends num> extension
Nullable numeric convenience utilities.
This extension adds small, allocation‑free helpers to any nullable num-typed value (int?, double?, etc.). The intent is to improve readability in conditions without forcing you to unwrap the value first.
Example:
int? attempts;
// ...
if (attempts.isZero) {
// Only runs when attempts == 0 (and not when attempts is null).
}
The helpers deliberately do not treat null
as a numeric value; a null
receiver simply results in false
for boolean predicates, letting you chain
additional null checks explicitly where needed.
- on
-
- T?
Properties
- isZero → bool
-
Available on T?, provided by the MaybeNumExtension extension
Returnstrue
when the underlying number is numerically zero.no setter