locale property
Locale?
locale
Returns the device's possibly ever-changing Locale. Notice how the AppState's locale is always the determined locale.
Implementation
Locale? get locale =>
appState?.locale ??
Localizations.maybeLocaleOf(context!) ??
_resolveLocales(
// The full system-reported supported locales of the device.
WidgetsBinding.instance.platformDispatcher.locales,
appState?.supportedLocales,
);
Set the App's Locale
Implementation
set locale(Locale? locale) {
if (locale != null) {
/// If 'supportedLocales' are specified, this Locale must be among them.
appState?.locale = locale;
}
}