init static method
Initialize Currency instance
locale
: If not specified, it will use the current default locale.name
: If specified, the currency with that ISO 4217 name will be usedsymbol
: Ifsymbol
provided, thenname
will be ignored.decimalDigits
: Sets number of decimal places. Default value is 2.
Implementation
static void init({
String? locale,
String? name,
String? symbol,
int decimalDigits = 2,
}) {
locale ??= Intl.defaultLocale;
final currency = NumberFormat.currency(
locale: locale,
name: name,
symbol: symbol,
decimalDigits: decimalDigits,
);
final currencyCompact = NumberFormat.compactCurrency(
locale: locale,
name: name,
symbol: symbol,
decimalDigits: decimalDigits,
);
final currencySimple = NumberFormat.simpleCurrency(
locale: locale,
name: name,
decimalDigits: decimalDigits,
);
final currencyCompactSimple = NumberFormat.compactSimpleCurrency(
locale: locale,
name: name,
decimalDigits: decimalDigits,
);
_instance = Currency._internal(
currency, currencyCompact, currencySimple, currencyCompactSimple);
}