Detailed documentation of the country_names package API.
The main widget for displaying a list of countries.
const CountryListView({
Key? key,
void Function(InternalCountry country)? onSelect,
CountryItemBuilder? itemBuilder,
OrderBy sortBy = OrderBy.name,
ImageQuality quality = ImageQuality.small,
})| Property | Type | Description |
|---|---|---|
| onSelect | void Function(InternalCountry country)? | Callback function called when a country is selected |
| itemBuilder | CountryItemBuilder? | Function to build custom country list items |
| sortBy | OrderBy | Determines how countries are sorted (by name or code) |
| quality | ImageQuality | Determines the quality of flag images (small or high) |
Class representing a country with its name, code, and flag.
const Country({
required this.name,
required this.code,
required this.flag,
})| Property | Type | Description |
|---|---|---|
| name | String | The name of the country |
| code | String | The ISO 3166-1 alpha-2 code of the country |
| flag | String | The path to the flag image asset |
Enum for specifying the sort order of countries.
| Value | Description |
|---|---|
| name | Sort countries alphabetically by name |
| code | Sort countries alphabetically by country code |
Enum for specifying the quality of flag images.
| Value | Description |
|---|---|
| small | Use smaller flag images (80px) |
| high | Use higher quality flag images (160px) |
Function type for building custom country list items.
typedef CountryItemBuilder = Widget Function(BuildContext context, InternalCountry country);