CountryStringExtension extension

Convenient extensions on String for Country/City operations

on

Properties

countryCities → List<String>

Available on String, provided by the CountryStringExtension extension

Returns list of cities for this country
no setter
countryDialCode → String?

Available on String, provided by the CountryStringExtension extension

Returns dial code (e.g. '+92') if this string matches a country
no setter
countryFlag → String?

Available on String, provided by the CountryStringExtension extension

Returns flag emoji if this string matches a country
no setter
countryOfCity → Country?

Available on String, provided by the CountryStringExtension extension

Returns the Country that this city belongs to (e.g. 'Lahore'.countryOfCity -> Country(Pakistan))
no setter

Methods

isCityOf(String countryQuery) → bool

Available on String, provided by the CountryStringExtension extension

Checks if this string is a known city of the specified country (name or ISO code)
searchAsCity({Country? inCountry, int limit = 50}) → List<String>

Available on String, provided by the CountryStringExtension extension

Search cities containing this string
toCountry() → Country?

Available on String, provided by the CountryStringExtension extension

Converts string (e.g. 'PK' or 'Pakistan') to Country object