localeResolutionCallback method

Locale? localeResolutionCallback(
  1. Locale? locale,
  2. Iterable<Locale> supportedLocales
)

Implementation

Locale? localeResolutionCallback(
  Locale? locale,
  Iterable<Locale> supportedLocales,
) {
  Locale? ret;
  int index = supportedLocales.toList().lastIndexWhere(
      (element) => element.languageCode == locale?.languageCode);
  if (index == -1) {
    ret = displayLanguageWhenNotSupported;
  } else {
    ret = supportedLocales.elementAt(index);
  }

  return ret;
}