format static method

String format(
  1. num number, [
  2. String? locale
])

Formats a number based on the given locale.

The method takes a number and a locale string, and formats the number according to the locale's decimal pattern. class to format the number in a way that is appropriate for the specified locale.

Example:

Number.format(1234567.89, 'en_US');

Output: '1,234,567.89'

Example with a different locale:

Number.format(1234567.89, 'de_DE');

Output: '1.234.567,89'

number The number to be formatted. locale The locale to use for formatting.

Returns a string representing the formatted number.

Implementation

static String format(num number, [String? locale]) {
  return Andomie.decimalFormatter(locale, number);
}