init static method

void init({
  1. Locale? locale,
  2. bool classic = true,
  3. bool crypto = true,
})

Implementation

static void init({Locale? locale, bool classic = true, bool crypto = true}) {
  if (_currencies.isNotEmpty) {
    return;
  }
  CurrencyDefaults.defaultLocale ??= locale ?? const Locale('en', 'US');
  if (classic) {
    _load(currencyList(CurrencyDefaults.labels));
  }
  if (crypto) {
    _load(cryptoList.map(_convertCrypto).toList());
  }
  CurrencyDefaults.defaultCurrency ??=
      identify(CurrencyDefaults.defaultLocale!);
  if (CurrencyDefaults.cache == null) {
    SharedPreferences.getInstance().then((v) => CurrencyDefaults.cache = v);
  }
}