findByPhoneCode static method

Country? findByPhoneCode(
  1. String phoneCode
)

Find the first country by phone code.

Supports inputs with and without '+' prefix.

Implementation

static Country? findByPhoneCode(String phoneCode) {
  final normalized = _normalizePhoneCode(phoneCode);
  if (normalized.isEmpty) return null;
  final countries = _countriesByPhoneCodeAll[normalized];
  if (countries == null || countries.isEmpty) return null;
  return countries.first;
}