tryParseCountryName static method

Country? tryParseCountryName(
  1. String countryName, {
  2. BuildContext? context,
  3. List<Locale>? locales,
})

Returns a single country if it matches the given countryName.

Returns null if no matching element is found.

Implementation

static Country? tryParseCountryName(
  String countryName, {
  BuildContext? context,
  List<Locale>? locales,
}) {
  try {
    return parseCountryName(countryName, context: context, locales: locales);
  } catch (_) {
    return null;
  }
}