NumberFormat.currencyPattern constructor Null safety

  1. @Deprecated('Use NumberFormat.currency')
NumberFormat.currencyPattern(
  1. [String? locale,
  2. String? currencyNameOrSymbol]
)

Create a number format that prints as CURRENCY_PATTERN. (Deprecated: prefer NumberFormat.currency)

If provided, use currencyNameOrSymbol in place of the default currency name. e.g. var eurosInCurrentLocale = NumberFormat .currencyPattern(Intl.defaultLocale, "€");

Implementation

@Deprecated('Use NumberFormat.currency')
factory NumberFormat.currencyPattern(
    [String? locale, String? currencyNameOrSymbol]) {
  // If it looks like an iso4217 name, pass as name, otherwise as symbol.
  if (currencyNameOrSymbol != null &&
      _checkCurrencyName.hasMatch(currencyNameOrSymbol)) {
    return NumberFormat.currency(locale: locale, name: currencyNameOrSymbol);
  } else {
    return NumberFormat.currency(
        locale: locale, symbol: currencyNameOrSymbol);
  }
}