setLocale method

void setLocale(
  1. Locale locale
)

setLocale is a function that takes a Locale object as a parameter and sets the _locale variable to the value of the Locale object

Args: locale (Locale): The locale to be set.

Returns: The current locale.

Implementation

void setLocale(Locale locale) {
  if (!_languages.contains(locale)) {
    return;
  }
  _locale = locale;
  notifyListeners();
}