DHUNullSafeNumExtensions extension
DHUNullSafeNumExtensions
- on
-
- num?
Properties
- asBool → bool
-
Available on num?, provided by the DHUNullSafeNumExtensions extension
Returnstrueif the number is greater than 0.no setter - isNegative → bool
-
Available on num?, provided by the DHUNullSafeNumExtensions extension
Returnstrueif the number is negative.no setter - isPositive → bool
-
Available on num?, provided by the DHUNullSafeNumExtensions extension
Returnstrueif the number is positive.no setter - isZeroOrNull → bool
-
Available on num?, provided by the DHUNullSafeNumExtensions extension
Returnstrueif the number is eithernullor zero.no setter
Methods
-
percentage(
num total, {bool allowDecimals = true}) → num -
Available on num?, provided by the DHUNullSafeNumExtensions extension
Returns the percentage ofthisvalue relative tototal, optionally allowing decimals. -
toDecimalString(
int decimalPlaces, {bool keepTrailingZeros = false}) → String -
Available on num?, provided by the DHUNullSafeNumExtensions extension
Returns a string representation of the number with a given number of decimal places. -
tryToDouble(
) → double? -
Available on num?, provided by the DHUNullSafeNumExtensions extension
Returns the double value of the number, ornullif the number isnull. -
tryToInt(
) → int? -
Available on num?, provided by the DHUNullSafeNumExtensions extension
Returns the integer value of the number, ornullif the number isnull.