nullIfZero property

T? get nullIfZero

Returns null if the number is 0, otherwise returns the number itself.

Implementation

T? get nullIfZero => this == 0 ? null : this;