langInfoFromKey function

LangInfo langInfoFromKey(
  1. String key
)

Resolve Locale information LangInfo through the locale key (es, en). Instead of null, if languageCode not found, returns an empty LangInfo

Implementation

LangInfo langInfoFromKey(String key) {
  key = normLocale(key, '-').toLowerCase();
  // key = key.replaceAll('_', '-');
  if (!kLangMap.containsKey(key)) {
    print('Language code not found: $key');
    return LangInfo(
      '',
      '',
      key,
      '',
    );
  }
  final vo = kLangMap[key]!;
  return LangInfo(
    vo['nativeName']!,
    vo['englishName']!,
    key,
    vo['emoji']!,
  );
}