isNotZeroOrNegative property

  1. @useResult
bool get isNotZeroOrNegative

Returns true if the number is not zero and not negative.

This is a convenient way to check if a number is strictly positive.

Example:

5.isNotZeroOrNegative; // Returns true
0.isNotZeroOrNegative; // Returns false
(-3).isNotZeroOrNegative; // Returns false

NaN is neither positive nor zero-or-negative, so both this and isZeroOrNegative return false for it (they are strict complements only for non-NaN values). The old this != 0 && !isNegative form wrongly classified NaN as positive. Audited: 2026-06-13

Implementation

@useResult
bool get isNotZeroOrNegative => this > 0;