getOrFallback method
Returns the first translation for the given language
BCP–47 tag.
If not found, then fallback:
- on the default
Locale
- on the undefined language
- on the English language
- 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]);