findDeviceLocale static method
Returns the locale of the device as the enum type. Fallbacks to base locale.
Implementation
static AppLocale findDeviceLocale() {
final String? deviceLocale = WidgetsBinding?.instance?.window?.locale.toLanguageTag();
if (deviceLocale != null) {
final typedLocale = _selectLocale(deviceLocale);
if (typedLocale != null) {
return typedLocale;
}
}
return _baseLocale;
}