destroyLocale method

bool destroyLocale(
  1. String locale
)

Removes locale and its data; clears the default locale if it was locale. Returns whether it existed.

Throws ArgumentError for the current locale.

Implementation

bool destroyLocale(String locale) {
  if (locale == _currentLocale) {
    throw ArgumentError('Attempted to destroy the current locale');
  }
  final removed = hasLocale(locale);
  _locales.remove(locale);
  _localeResources.remove(locale);
  if (locale == _defaultLocale) _defaultLocale = null;
  return removed;
}