https://github.com/paulpascal/country_state_city
https://github.com/paulpascal/country_state_city
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/paulpascal/country_state_city
- Owner: paulpascal
- License: mit
- Created: 2022-08-16T12:29:42.000Z (almost 4 years ago)
- Default Branch: develop
- Last Pushed: 2024-07-12T11:59:05.000Z (almost 2 years ago)
- Last Synced: 2024-07-12T13:48:22.831Z (almost 2 years ago)
- Language: Dart
- Size: 2.72 MB
- Stars: 5
- Watchers: 3
- Forks: 11
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Authors: AUTHORS
Awesome Lists containing this project
README
# country_state_city
 
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](https://flutter.io/platform-plugins/).
```dart
// import country_state_city package
import 'package:country_state_city/country_state_city.dart';
```
```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> getAllCountries()` | Get world wide countries list. |
| `Future getCountryFromCode(String countryCode)` | Get country from its ISO CODE |
| `Future> getAllStates()` | Get world wide states list. |
| `Future> getStatesOfCountry(String countryCode)` | Get the list of states that belongs to a country by the country ISO CODE |
| `Future getStateByCode(String countryCode, String stateCode,)` | Get a state from its code and its belonging country code |
| `Future> getAllCities()` | Get world wide cities list. |
| `Future> 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> 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
- [Harpreet Singh](https://github.com/harpreetkhalsagtbit)