DHUNumExtensions extension

DHUNumExtensions

on

Properties

asDays Duration

Available on num, provided by the DHUNumExtensions extension

Converts the number to a Duration in days.
no setter
asHours Duration

Available on num, provided by the DHUNumExtensions extension

Converts the number to a Duration in hours.
no setter
asMilliseconds Duration

Available on num, provided by the DHUNumExtensions extension

Converts the number to a Duration in milliseconds.
no setter
asMinutes Duration

Available on num, provided by the DHUNumExtensions extension

Converts the number to a Duration in minutes.
no setter
asSeconds Duration

Available on num, provided by the DHUNumExtensions extension

Converts the number to a Duration in seconds.
no setter
fourth double

Available on num, provided by the DHUNumExtensions extension

Returns one-fourth of the number.
no setter
getRandom int

Available on num, provided by the DHUNumExtensions extension

Generates a random integer between 0 (inclusive) and this value (exclusive).
no setter
half double

Available on num, provided by the DHUNumExtensions extension

Returns half of the number.
no setter
isInteger bool

Available on num, provided by the DHUNumExtensions extension

Checks if this number is an integer.
no setter
isNegative bool

Available on num, provided by the DHUNumExtensions extension

Returns true if the number is negative.
no setter
isPositive bool

Available on num, provided by the DHUNumExtensions extension

Returns true if the number is positive.
no setter
isValidPhoneNumber bool

Available on num, provided by the DHUNumExtensions extension

Returns true if the string representation of this number is a valid phone number.
no setter
isZero bool

Available on num, provided by the DHUNumExtensions extension

Returns true if the number is zero.
no setter
numberOfDigits int

Available on num, provided by the DHUNumExtensions extension

Returns the number of digits in this number.
no setter
removeTrailingZero String

Available on num, provided by the DHUNumExtensions extension

Removes trailing zeros from the string representation of the number.
no setter
roundToFiftyOrHundred double

Available on num, provided by the DHUNumExtensions extension

Rounds the number up to the nearest multiple of 50.
no setter
roundToTenth double

Available on num, provided by the DHUNumExtensions extension

Rounds the number to the nearest multiple of 10.
no setter
tenth double

Available on num, provided by the DHUNumExtensions extension

Returns one-tenth of the number.
no setter
third double

Available on num, provided by the DHUNumExtensions extension

Returns one-third of the number.
no setter

Methods

asGreeks([int zerosFractionDigits = 0, int fractionDigits = 1]) String

Available on num, provided by the DHUNumExtensions extension

Converts a number to a string with Greek symbols for thousands, millions, etc.
daysDelay<T extends Object?>([FutureOr<T> computation()?]) Future<T>

Available on num, provided by the DHUNumExtensions extension

Delay equivalent to the number of days.
hoursDelay<T extends Object?>([FutureOr<T> computation()?]) Future<T>

Available on num, provided by the DHUNumExtensions extension

Delay equivalent to the number of hours.
isApproximatelyEqual(num other, {double tolerance = 0.01}) bool

Available on num, provided by the DHUNumExtensions extension

Checks if this number is approximately equal to other within a tolerance.
isBetween(num min, num max, {bool inclusive = true}) bool

Available on num, provided by the DHUNumExtensions extension

Checks if this number is between min and max. inclusive determines whether the range includes the endpoints.
isCloseTo(num other, {num delta = 0.1}) bool

Available on num, provided by the DHUNumExtensions extension

Checks if this number is close to other within a delta.
millisecondsDelay<T extends Object?>([FutureOr<T> computation()?]) Future<T>

Available on num, provided by the DHUNumExtensions extension

Delay equivalent to the number of milliseconds.
minutesDelay<T extends Object?>([FutureOr<T> computation()?]) Future<T>

Available on num, provided by the DHUNumExtensions extension

Delay equivalent to the number of minutes.
random([int? seed]) int

Available on num, provided by the DHUNumExtensions extension

Generates a random integer between 0 (inclusive) and this value (exclusive), with an optional seed for reproducibility.
roundDownToMultiple(num multiple) num

Available on num, provided by the DHUNumExtensions extension

Rounds this number down to the nearest multiple of multiple.
roundToNearestMultiple(num multiple) num

Available on num, provided by the DHUNumExtensions extension

Rounds this number to the nearest multiple of multiple.
roundUpToMultiple(num multiple) num

Available on num, provided by the DHUNumExtensions extension

Rounds this number up to the nearest multiple of multiple.
safeDivide(num b, {num whenBothZero = 0, num whenDivByZero = double.infinity, bool returnNaNOnDivByZero = false}) double

Available on num, provided by the DHUNumExtensions extension

Safely divides two numbers with custom handling for division by zero and zero values.
scaleBetween(num min, num max) num

Available on num, provided by the DHUNumExtensions extension

Normalizes this number to a range between min and max.
secondsDelay<T extends Object?>([FutureOr<T> computation()?]) Future<T>

Available on num, provided by the DHUNumExtensions extension

Delay equivalent to the number of seconds.
sqrt() double

Available on num, provided by the DHUNumExtensions extension

Returns the square root of the number.
toFileSize({int decimals = 2}) String

Available on num, provided by the DHUNumExtensions extension

Converts bytes to a human-readable string (e.g., "1.5 MB").
toFractionString() String

Available on num, provided by the DHUNumExtensions extension

Converts this number to a fraction string representation.
toOrdinal({bool asWord = false, bool includeAnd = false}) String

Available on num, provided by the DHUNumExtensions extension

Converts the number to its ordinal representation as either a number with a suffix (e.g., "1st") or as a word (e.g., "first").
toPercent({int fractionDigits = 2}) String

Available on num, provided by the DHUNumExtensions extension

Converts this number to a percentage string with fractionDigits decimal places.
until(int end, {int step = 1}) Iterable<num>

Available on num, provided by the DHUNumExtensions extension

Returns a sequence of integers starting from this, incrementing by step and ending at end.