nonZeroSign property
int
get
nonZeroSign
The sign of this integer.
Like sign except that it returns 1 for zero (considering it positive).
-0.0 is treated the same as 0.0 (so, considered positive), returning 1.
Example:
5.nonZeroSign == 1
0.nonZeroSign == 1
(-0.0).nonZeroSign == 1
(-2).nonZeroSign == -1
Implementation
int get nonZeroSign => this < 0 ? -1 : 1;