A complete Flutter package to pick and validate Country → State → City using dropdowns or typeaheads, or auto-fill them by entering a pincode/postal code.
Perfect for apps that collect addresses: e-commerce, delivery, registration, checkout, etc.
- ⚡ Fully offline address picker (no runtime API calls)
- 📍 Auto-detect State and City from Pincode / Postal Code
- 🌐 Built-in dataset of countries, states, and cities
- 🎯 RegEx-based country-specific postal code validation
- 🧩 Custom layouts using individual picker widgets
- 🔎 Supports DropdownSearch and TypeAheadSearch
- 🔧 Utility APIs if you want to build your own UI
|
|
dependencies:
pincode_country_state_city_pro: ^1.0final controller = AddressPickerController();
PincodeCountryStateCityPicker(
controller: controller,
)You can build your own layouts using the individual pickers provided by the package.
//All pickers automatically stay in sync using the same controller.
final controller = AddressPickerController();
Column(
children: [
Row(
children: [
CountryPicker(
pickerProps: PickerProps(controller: controller),
),
PincodeField(controller: controller),
],
),
Row(
children: [
StatePicker(),
CityPicker(),
],
),
],
)final controller = AddressPickerController();
controller.selectedCountry.addListener(() {
print(controller.selectedCountry.value?.name);
});controller.selectedCountry.value;
controller.selectedState.value;
controller.selectedCity.value;List<Country> countries = await getAllCountries();
Country? india = await getCountryByIsoCode(isoCode: "IN");List<StateModel> states = await getStatesOfCountry(countryCode: "IN");
StateModel? state = await getStateByCode(countryCode: "IN", stateCode: "TG");List<City> cities = await getCitiesOfState(countryCode: "IN", stateCode: "AP");
City? city = await getCityByPostalCode(postalCode: "502103", countryCode: "TG");AddressData addressData = await getStateAndCityByPostalCode(postalCode: "502103", countryCode: "IN");
State state = addressData.state;
City city = addressData.city;PostalCodeFormat? postalCodeFormat = getPostalFormatFromCountryCode(countryCode : "IN");🙌 Contributing : Found a bug? Want to add more data or improve UX? PRs are welcome!! Open issues, contribute, or star the repo 💙

