getOrFallback method

Translation? getOrFallback(
  1. String? language
)

Returns the first translation for the given language BCP–47 tag. If not found, then fallback:

  1. on the default Locale
  2. on the undefined language
  3. on the English language
  4. the first translation found

Implementation

Translation? getOrFallback(String? language) =>
    translations[language] ??
    translations[Platform.localeName] ??
    translations[null] ??
    translations[undefinedLanguage] ??
    translations["en"] ??
    translations.keys.firstOrNull?.let((it) => translations[it]);