setCurrentLocale method

void setCurrentLocale(
  1. Locale locale
)

Sets the current locale for translations.

Throws an ArgumentError if the locale is empty.

Usage:

localizations.setCurrentLocale(const Locale('fr'));

Implementation

void setCurrentLocale(Locale locale) {
  if (locale.languageCode.isEmpty) {
    throw ArgumentError('Locale cannot be empty');
  }
  _currentLocale = locale;
}