getMessage method
Returns the translated text paired with the key txt
.
If txt
doesn't exist for a certain language or the lang
is not defined in the Map,
txt
is returned as-is.
Implementation
String? getMessage({required String? txt, String? lang}) {
lang ??= currentLanguage;
if (txt == null) {
return txt;
}
return (_messages[lang] ?? <String, dynamic>{})[txt] ?? txt;
}