findDeviceLocale static method

AppLocale findDeviceLocale([
  1. String? locale,
  2. bool? isStore
])

Implementation

static AppLocale findDeviceLocale([String? locale, bool? isStore]) {
  final isStorePara = isStore ?? false;
  final String deviceLocale =
      locale ?? WidgetsBinding.instance.window.locale.toLanguageTag();
  if (isStorePara) {
    deviceLocaleStored = deviceLocale;
  }
  if (deviceLocale != null) {
    final typedLocale = _selectLocale(deviceLocale);
    if (typedLocale != null) {
      return typedLocale;
    }
  }
  return AppLocale.en;
}