searchByPhoneCode static method

List<Country> searchByPhoneCode(
  1. String phoneCode
)

Search countries by phone code only

phoneCode is the phone code to search for (e.g., '+1', '+7')

Implementation

static List<Country> searchByPhoneCode(String phoneCode) {
  if (phoneCode.isEmpty) return countries;

  final results = countries
      .where((country) => country.phoneCode.contains(phoneCode))
      .toList();

  return results;
}