fromLocale static method

CurrencyFormat? fromLocale([
  1. String? locale,
  2. List<CurrencyFormat> currencies = CurrencyFormatter.majorsList
])

Get the CurrencyFormat of a currency using its locale.

If locale is not specified, the local currency will be used.

If currencies is not specified, the majors list will be used.

// Get the local currency with a custom currencies list.
CurrencyFormat? local = CurrencyFormat.fromLocale(null, myCurrencies);

Implementation

static CurrencyFormat? fromLocale([
  String? locale,
  List<CurrencyFormat> currencies = CurrencyFormatter.majorsList,
]) =>
    fromSymbol(
      NumberFormat.simpleCurrency(locale: locale ?? localeName)
          .currencySymbol,
    );