Country

data class Country(val iso2Code: String, val iso3Code: String, val displayName: String, val dialCode: String, val flag: String?, val region: CountryRegion, val alternativeNames: List<String> = emptyList())(source)

The canonical country representation for the whole library.

Identity is iso2Code and nothing else. Dial codes are explicitly not unique — +1 is shared by the US, Canada and a dozen Caribbean territories, and +44 by the UK, Jersey, Guernsey and the Isle of Man — so equals/hashCode and every list key are derived from the ISO alpha-2 code alone.

Instances are cheap to compare and safe to use as Compose keys: the class is Immutable, and the normalized search fields are computed once when the dataset is built rather than per recomposition (see normalizedName, normalizedAliases).

Constructors

Link copied to clipboard
constructor(iso2Code: String, iso3Code: String, displayName: String, dialCode: String, flag: String?, region: CountryRegion, alternativeNames: List<String> = emptyList())

Properties

Link copied to clipboard

Extra names and abbreviations matched by search (e.g. "uae", "holland", "deutschland"). Never shown in the UI.

Link copied to clipboard

International dial code including the leading + (e.g. "+254").

Link copied to clipboard

dialCode without the leading + (e.g. "254"). Used for numeric dial-code search.

Link copied to clipboard

Name shown to the user (e.g. "Kenya"). See com.ezzy.ccp.countrypicker.data.DefaultCountryDataSource.localizedNames for the locale-aware variant resolved by the data source.

Link copied to clipboard
val flag: String?

Default flag representation — a regional-indicator emoji, or null for the few codes with no emoji sequence (e.g. XK), which fall back to rendering the ISO code.

Link copied to clipboard

ISO 3166-1 alpha-2 code, uppercase (e.g. "KE"). The stable identity.

Link copied to clipboard

ISO 3166-1 alpha-3 code, uppercase (e.g. "KEN").

Link copied to clipboard

Geographic region used by the sheet's region filters.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Projects a canonical Country into the legacy model.

Link copied to clipboard

Projects a canonical Country into the legacy SelectedCountry used by Phone.

Link copied to clipboard
open override fun toString(): String