setLocale method

Future<E> setLocale(
  1. E locale, {
  2. bool? listenToDeviceLocale = false,
})

Sets locale. Returns the locale which has been set.

Locale gets changed automatically if listenToDeviceLocale is true and TranslationProvider is used. If null, then the last state is used. By default, calling this method disables the listener.

Implementation

Future<E> setLocale(E locale, {bool? listenToDeviceLocale = false}) async {
  if (lazy) {
    await loadLocale(locale);
  }
  return _setLocale(locale, listenToDeviceLocale: listenToDeviceLocale);
}