NumNullExtensions<T extends num?> extension
Extension methods for nullable numbers.
- on
-
- T
Properties
- isNonZeroNegative → bool
-
Available on T, provided by the NumNullExtensions extension
Checks whether the number is a non-zero negative number.no setter - isNonZeroPositive → bool
-
Available on T, provided by the NumNullExtensions extension
Checks whether the number is a non-zero positive number.no setter - isNullOrZero → bool
-
Available on T, provided by the NumNullExtensions extension
Checks whether the number is 0 or null.no setter - nullIfZero → T?
-
Available on T, provided by the NumNullExtensions extension
Returns null if the number is 0, otherwise returns the number itself.no setter
Methods
-
fixedLength(
int length, {String fill = "0", int fractionDigits = 0}) → String? -
Available on T, provided by the NumNullExtensions extension
Returns a string representation of the number with a fixed length, including the decimal separator if needed. -
getColor(
[Map< T, Color> colorStep = const {}]) → Color -
Available on T, provided by the NumNullExtensions extension
Get the color of a number based on a map of color steps. if the number is less than the minimum key, the color of the minimum key is returned. if the number is greater than the maximum key, the color of the maximum key is returned. if the number is between two keys, the color is interpolated between the two colors. if the number is equal to a key, the color of the key is returned. if the number is null, the color is transparent. if the color step is empty, the color is computed by converting the int value into Color using the default constuctor . -
percentOf(
T total) → double -
Available on T, provided by the NumNullExtensions extension
Returns the percentage of the current number in relation to the total number. If the total number is null or 0, it returns 0. Otherwise, it returns the percentage value. The percentage is calculated as a double value between 0 and 1, where 1 represents 100%. -
toRoman(
) → string -
Available on T, provided by the NumNullExtensions extension
Returns the integer part of a decimal number into a Roman number.