pincode_country_state_city_pro library

Offline-first Flutter package providing country, state, and city dropdowns with typeahead search, pincode-based auto-fill, and country-specific postal code validation.

This package includes:

  • Built-in country/state/city dataset
  • Pincode → State/City auto resolution
  • Customizable picker UI layouts
  • Utility APIs for headless usage (no UI)

Ideal for address forms in e-commerce, onboarding, delivery, and checkout flows.

Functions

getAllCities() Future<List<City>>
Get the list of all cities of the world
getAllCountries() Future<List<Country>>
Get the list of all the countries in the world
getAllStates() Future<List<StateModel>>
Get the list of all States in the world
getCitiesOfCountry({required String countryCode}) Future<List<City>>
Get the list of cities of a country
getCitiesOfState({required String countryCode, required String stateCode}) Future<List<City>>
Get the list of cities of a state
getCityByCode({required String cityCode}) Future<City?>
Get state from its isoCode
getCountryByIsoCode({required String isoCode}) Future<Country?>
Get Country from its IsoCode(alpha-2 code)
getKeyboardTypeForPincodeFormat({required PostalCodeFormat postalCodeFormat}) TextInputType
getMatchingCityByName({required String cityName}) Future<City?>
Get Matching City by Name
getMatchingStateByName({required String stateName, required String countryCode}) Future<StateModel?>
Get Matching State by Name
getPostalFormatFromCountryCode({required String countryCode}) Future<PostalCodeFormat?>
getStateAndCityByPostalCode({required String postalCode, required String countryCode}) Future<AddressData?>
Get State and City from postalCode and CountryCode(alpha-2 code)
getStateByCode({required String stateCode, required String countryCode}) Future<StateModel?>
Get state from its isoCode
getStatesOfCountry({required String countryCode}) Future<List<StateModel>>
Get the list of States of a Country

Typedefs

DecorationBuilder = Widget Function(BuildContext context, Widget child)
SuggestionsCallback<T> = FutureOr<List<T>?> Function(String search)
SuggestionsItemBuilder<T> = Widget Function(BuildContext context, T value)
TextFieldBuilder = Widget Function(BuildContext context, TextEditingController controller, FocusNode focusNode)