The flutter project for provide province, district, sub-district in thailand.
Download or clone repository and add a dependency on the thai_region
package in the dependencies
section of pubspec.yaml (recommend use this):
dependencies:
thai_region:
path: ../PATH_ROOT_DIRECTORY_PLUGIN/
or to get the experimental one:
dependencies:
thai_region:
git:
url: https://github.com/skwcrd/thai_region.git
ref: main
and then run the shell.
flutter pub get
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
Import package thai_region.dart
to the project:
import 'package:thai_region/thai_region.dart';
Create instance ThaiRegion
class:
var thaiRegion = ThaiRegion();
var region = thaiRegion.getRegion();
var province = thaiRegion.getProvince();
Get by provide RegionType:
var province = thaiRegion.getProvince(region: RegionType.central);
var district = thaiRegion.getDistrict();
Get by provide province ID:
var district = thaiRegion.getDistrict(provinceId: 'XX');
var subDistrict = thaiRegion.getSubDistrict();
Get by provide district ID:
var subDistrict = thaiRegion.getSubDistrict(districtId: 'XXXX');
Method/Attribute | Params | Return | Return Type |
---|---|---|---|
id | None | Data ID | String |
Reference ID (regionId, provinceId, districtId) | None | Reference ID | String |
zipCode (For SubDistrict class only) | None | Postal code of each sub-district | String |
getName(...) | locale (default: Locale('en')) | Localization name | String |
toMap() | None | Map data models | Map<String, dynamic> |
Refer to the Changelog to get all release notes.