tryParse static method
Implementation
static Country? tryParse(String locale) {
if (locale.trim().isEmpty) return null;
List<String> codes = [];
if (locale.contains("_")) {
codes = locale.split("_");
} else if (locale.contains("-")) {
codes = locale.split("-");
}
if (codes.length != 2) return null;
String lc = codes.elementAt(0);
String cc = codes.elementAt(1);
return Country.fromCode(cc, lc);
}