Search packages, repositories and app categories

Package detailsv0.1.6

country_state_city

A flutter package to display list of Countries, States and Cities depends on a given country

AndroidiOSWebmacOSWindowsLinux
30-day downloads
16.2K
Likes
41
Pub points
160

Install package

flutter pub add country_state_city

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter package that provides a simple way to display lists of countries, states, and cities based on the selected country. It enables dynamic population of state and city dropdowns, making it ideal for forms requiring location-based data entry. The package supports multiple platforms including Android, iOS, Web, macOS, Windows, and Linux, ensuring cross-platform consistency. It is lightweight and easy to integrate with minimal setup required.

Use cases

  • Form inputs requiring location selection
  • Dynamic state and city dropdowns
  • User registration with location fields
  • E-commerce shipping address collection
  • Multi-language location support

Key features

  • Auto-populates states and cities based on country
  • Supports all major platforms
  • Lightweight and easy to integrate
  • Preloaded data for global locations
  • Simple API with minimal configuration

Suitable for

  • Developers building international apps
  • Apps needing dynamic location selection
  • Forms with country-state-city hierarchies
  • Cross-platform applications requiring location data

Considerations

  • Requires internet for initial data loading (if not bundled)
  • Limited customization of UI components
  • Data set size may affect initial load time
  • No built-in localization support
  • Depends on external data source for accuracy

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

country_state_city

version version

A flutter package to display list of world wide Countries, States and Cities. It also allows to get a list of States and Cities depends on given country (by ISO CODE).

How to Use

To use this Package, add country_state_city as a dependency in your pubspec.yaml.

// import country_state_city package
import 'package:country_state_city/country_state_city.dart';
// Get all countries
final countries = await getAllCountries();

// Get all states that belongs to a country by country ISO CODE
final states = await getStatesOfCountry('AF'); // Afghanistan

APIs

Function Description
Future<List<Country>> getAllCountries() Get world wide countries list.
Future<Country?> getCountryFromCode(String countryCode) Get country from its ISO CODE
Future<List<State>> getAllStates() Get world wide states list.
Future<List<State>> getStatesOfCountry(String countryCode) Get the list of states that belongs to a country by the country ISO CODE
Future<State?> getStateByCode(String countryCode, String stateCode,) Get a state from its code and its belonging country code
Future<List<City>> getAllCities() Get world wide cities list.
Future<List<City>> getStateCities(String countryCode, String stateCode) Get the list of states that belongs to a state by the state ISO CODE and the country ISO CODE
Future<List<City>> getCountryCities(String countryCode) Get the list of cities that belongs to a country by the country ISO CODE

Classes

Class Description
Country Handle country data such as: (name, isoCode, phoneCode, flag, currency, latitude, longitude, timezones)
State Handle state data such as: (name, countryCode, isoCode, latitude, longitude)
City Handle city data such as: (name, countryCode, stateCode, latitude, longitude)
Timezone Handle timezone data such as: (name, gmtOffset, gmtOffsetName, abbreviation, tzName)
Special Thanks to

Categories

Source repository

Projects using this package

No data available yet.