country_subdivision_data library
Offline country, subdivision, and city reference data.
Classes
- AssetCountrySubdivisionRepository
- Repository backed by the package's lazily loaded compressed assets.
- City
- A city or equivalent locality in the bundled snapshot.
- Country
- A country in the bundled snapshot.
- CountryPhoneField
- Fully customizable country-aware phone-number form field.
- CountryPhoneNumber
- A phone value paired with its selected country.
- CountryPickerDialog
- Fully customizable searchable country-picker dialog.
- CountryPickerDialogConfiguration
- Visual and behavioral defaults for CountryPickerDialog.
- CountrySubdivisionData
- Main facade for bundled country, subdivision, and city data.
- CountrySubdivisionRepository
- Storage abstraction used by CountrySubdivisionData.
- CountrySubdivisionSnapshotMetadata
- Provenance, integrity, and record counts for the bundled snapshot.
- Subdivision
- A first-level administrative subdivision such as a state or province.
Functions
-
countryFlagEmoji(
String iso2) → String - Converts a two-letter ASCII ISO country code to a flag emoji.
-
normalizedDialingCode(
Country country) → String -
Returns a country calling code with exactly one leading
+. -
showCountryPickerDialog(
{required BuildContext context, required List< Country> countries, Country? selectedCountry, CountryPickerDialogConfiguration configuration = const CountryPickerDialogConfiguration(), CountryPickerItemBuilder? itemBuilder, CountryPickerSearchFieldBuilder? searchFieldBuilder, CountryPickerFlagBuilder? flagBuilder, CountryPickerTitleBuilder? titleBuilder, CountryPickerEmptyBuilder? emptyBuilder, CountryPickerDialogBuilder? dialogBuilder, TextEditingController? searchController, bool barrierDismissible = true, Color? barrierColor, String? barrierLabel, RouteSettings? routeSettings, Offset? anchorPoint}) → Future<Country?> - Presents a CountryPickerDialog and returns the selected country.
Typedefs
- CountryPhoneErrorBuilder = Widget Function(BuildContext context, Object error, VoidCallback retry)
- Builds a state shown when countries cannot be loaded.
- CountryPhoneLoadingBuilder = Widget Function(BuildContext context)
- Builds a state shown while countries load.
- CountryPhoneSelectorBuilder = Widget Function(BuildContext context, Country? country, bool enabled, VoidCallback openPicker)
- Builds the button used to open the country picker.
-
CountryPhoneTextFieldBuilder
= Widget Function(BuildContext context, TextEditingController controller, FocusNode focusNode, Country? country, bool enabled, VoidCallback openPicker, ValueChanged<
String> onChanged) - Completely replaces the default phone text field.
- CountryPickerDialogBuilder = Widget Function(BuildContext context, Widget content)
-
Wraps or replaces the default dialog around
content. - CountryPickerEmptyBuilder = Widget Function(BuildContext context, String query)
-
Builds the no-results state for a normalized
query. - CountryPickerFlagBuilder = Widget Function(BuildContext context, Country country)
- Builds the country flag or other leading content.
- CountryPickerItemBuilder = Widget Function(BuildContext context, Country country, bool isSelected, VoidCallback select)
- Builds one selectable country row.
-
CountryPickerPresenter
= Future<
Country?> Function(BuildContext context, List<Country> countries, Country? selectedCountry) - Presents a custom country picker route.
-
CountryPickerSearchFieldBuilder
= Widget Function(BuildContext context, TextEditingController controller, ValueChanged<
String> onChanged) - Builds the search field used by CountryPickerDialog.
- CountryPickerTitleBuilder = Widget Function(BuildContext context, VoidCallback close)
- Builds the picker title.
Exceptions / Errors
- CountrySubdivisionAssetException
- Thrown when a bundled snapshot asset cannot be loaded or decoded.
- CountrySubdivisionDataFormatException
- Thrown when bundled JSON does not match the normalized snapshot schema.
- CountrySubdivisionInitializationException
- Thrown when the package cannot initialize its snapshot repository.
- CountrySubdivisionSnapshotException
- Thrown when snapshot integrity or provenance validation fails.