loadILibLocaleData method

Future<void> loadILibLocaleData(
  1. String? locale
)

Load and cache the JSON data for locale, notifying listeners only if it differs from the last loaded locale (reloading the same one is a no-op for listeners). Pass null to reload the current locale. No-op if not ready.

Implementation

Future<void> loadILibLocaleData(String? locale) async {
  if (!_iLibPrepared) {
    return;
  }

  // normalizeLocale maps C/POSIX/empty to en-US instead of rejecting.
  locale = normalizeLocale(locale ?? currentLocale);
  if (!isValidLocale(locale)) {
    return;
  }

  await _loadLocaleData(locale);

  if (_lastLoadedLocale != locale) {
    _lastLoadedLocale = locale;
    notifyListeners();
  }
}