NumExtension<T extends num> extension

Utilities for formatting, converting, and comparing numbers.

on
  • T

Properties

carats → double

Available on T, provided by the NumExtension extension

Convert grams to carats
no setter
caratsToGrams → double

Available on T, provided by the NumExtension extension

From Carats to grams
no setter
celsius → double

Available on T, provided by the NumExtension extension

Convert fahrenheit to celsius
no setter
days → Duration

Available on T, provided by the NumExtension extension

Converts this number to a Duration in days.
no setter
degrees → double

Available on T, provided by the NumExtension extension

Convert radians to degree
no setter
fahrenheit → double

Available on T, provided by the NumExtension extension

Convert celsius to fahrenheit
no setter
hours → Duration

Available on T, provided by the NumExtension extension

Converts this number to a Duration in hours.
no setter
kilometers → double

Available on T, provided by the NumExtension extension

Convert miles to kilometers
no setter
microseconds → Duration

Available on T, provided by the NumExtension extension

Converts this number to a Duration in microseconds.
no setter
miles → double

Available on T, provided by the NumExtension extension

Convert kilometers to miles
no setter
milliseconds → Duration

Available on T, provided by the NumExtension extension

Converts this number to a Duration in milliseconds.
no setter
millisecondsToDateTime → DateTime

Available on T, provided by the NumExtension extension

Convert milliseconds to DateTime
no setter
millisecondsToUTCDateTime → DateTime

Available on T, provided by the NumExtension extension

Convert milliseconds to UTCDateTime
no setter
minutes → Duration

Available on T, provided by the NumExtension extension

Converts this number to a Duration in minutes.
no setter
ounces → double

Available on T, provided by the NumExtension extension

Convert grams to ounces
no setter
ouncesToGrams → double

Available on T, provided by the NumExtension extension

From Ounces to grams
no setter
radians → double

Available on T, provided by the NumExtension extension

Convert degrees to radians
no setter
seconds → Duration

Available on T, provided by the NumExtension extension

Converts this number to a Duration in seconds.
no setter

Methods

between(num min, num max) → bool

Available on T, provided by the NumExtension extension

Returns true if this is between the given min (inclusive) and max (exclusive).
clampTo(num min, num max) → num

Available on T, provided by the NumExtension extension

Returns this number constrained to the inclusive range min..max.
fixed([int fractionDigits = 6]) → num

Available on T, provided by the NumExtension extension

Fix fraction digits for num
isBetween(num min, num max, {bool includeMin = true, bool includeMax = true}) → bool

Available on T, provided by the NumExtension extension

Returns true if this number is between min and max.
outside(num min, num max) → bool

Available on T, provided by the NumExtension extension

Returns true if this number is outside the given range of min (exclusive) and max (exclusive).
padLeft(int width, [String padding = '0']) → String

Available on T, provided by the NumExtension extension

Transforms this into a String and pads it on the left if it is shorter than the given width.
padRight(int width, [String padding = '0']) → String

Available on T, provided by the NumExtension extension

Transforms this into a String and pads it on the right if it is shorter than the given width.
percentage({int fixed = 2, bool fit = false}) → String

Available on T, provided by the NumExtension extension

Converts a number into a percentage string.
permille({int fixed = 2, bool fit = false}) → String

Available on T, provided by the NumExtension extension

Converts a number into a per mille string. The number is multiplied by 1000 and a '‰' sign is appended.
permyriad({int fixed = 2, bool fit = false}) → String

Available on T, provided by the NumExtension extension

Converts a number into a per myriad string. The number is multiplied by 10000 and a '‱' sign is appended.
roundTo([int fractionDigits = 0]) → double

Available on T, provided by the NumExtension extension

Rounds this number to fractionDigits decimal places.
thousands() → String

Available on T, provided by the NumExtension extension

Formats a number with thousands separators (commas).
timer({String format = 'mm:ss'}) → String

Available on T, provided by the NumExtension extension

Converts a number representing total seconds into a time-formatted string.