isSupported method

  1. @override
bool isSupported(
  1. Locale locale
)
override

Indicate to the Flutter framework this delegate can support the passed Locale.

Implementation

@override
bool isSupported(Locale locale) {
  //
  bool supported;

  // Assume you're supplied the App's Locale.
  if (L10n._appLocale == null) {
    L10n.locale = locale;
    supported = L10n._appLocale == locale;
  } else {
    supported = locale == L10n._appLocale;
  }
  // The device's Locale
  if (!supported) {
    supported = locale == L10n.deviceLocale;
  }
  // Check the supported Locales
  if (!supported) {
    // supported = L10n._localesSupported.contains(locale);
    supported = L10n.supportedLocales.contains(locale);
  }
  return supported;
}