localeResolutionCallback static method
Implementation
static Locale? localeResolutionCallback(
Locale? locale, Iterable<Locale>? supportedLocales) {
//
final _appLocale = appLocale;
// Override the system's preferred locale with the app's preferred locale.
if (_appLocale != null) {
locale = _appLocale;
}
if (locale == null) {
// Retrieve the 'first' locale in the supported locales.
supportedLocales ??=
I10n.supportedLocales!.take(I10n.supportedLocales!.length);
if (supportedLocales.isNotEmpty) {
// Use the first supported locale.
locale = supportedLocales.first;
}
}
return locale;
}