fromLanguageTag static method
Implementation
static Locale? fromLanguageTag(String? languageTag) {
if (languageTag == null) return null;
List<String> split = languageTag.split('-');
switch (split.length) {
case 1:
return Locale(split[0]);
case 2:
return Locale(split[0], split[1]);
case 3:
return Locale.fromSubtags(
languageCode: split[0],
scriptCode: split[1],
countryCode: split[2],
);
}
return null;
}