NumExtensions extension
Extension functions to help perform common operations and formatting on num values.
- on
Methods
-
isZero(
{double precision = 1e-8}) → bool -
Available on num, provided by the NumExtensions extension
Returnstrueif the number is equal to 0 within a small tolerance (useful for floating-point precision). -
roundToPrecision(
{int numbersToRoundTo = 2}) → double -
Available on num, provided by the NumExtensions extension
Rounds the number to the given number of decimal places. -
toFormattedCurrencyNumber(
{String format = "#,##0.00##", String locale = 'en', String? currencySymbol}) → String -
Available on num, provided by the NumExtensions extension
Formats the number using a custom pattern and locale, optionally prefixing with a currency symbol. -
toFormattedNumber(
{required String format, String locale = 'en'}) → String -
Available on num, provided by the NumExtensions extension
Formats the number using the given pattern and locale. -
toLocalizedArabicNumber(
{String format = '#.##'}) → String -
Available on num, provided by the NumExtensions extension
Formats the number using Arabic numerals with optional format. -
toLocalizedArabicOrEnglishNumber(
{String format = '#.##'}) → String -
Available on num, provided by the NumExtensions extension
Formats the number using Arabic or English numerals depending on the current locale. -
toLocalizedCurrencyNumber(
{String format = "#,##0.00##", String? locale, String? currencySymbol}) → String -
Available on num, provided by the NumExtensions extension
Formats the number as a currency string using the current locale from PlayxLocalization. -
toLocalizedEnglishNumber(
{String format = '#.##'}) → String -
Available on num, provided by the NumExtensions extension
Formats the number using English numerals with optional format. -
toLocalizedNumber(
{String? locale, String format = '#.##'}) → String -
Available on num, provided by the NumExtensions extension
Formats the number according to the given or current locale and format.