Skip to content

The flutter project for provide province, district, sub-district in thailand.

License

Notifications You must be signed in to change notification settings

skwcrd/thai_region

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Region in Thailand

Build Status

The flutter project for provide province, district, sub-district in thailand.

Getting Started

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.

Usage

Import package thai_region.dart to the project:

import 'package:thai_region/thai_region.dart';

Create class object

Create instance ThaiRegion class:

var thaiRegion = ThaiRegion();

Get region

var region = thaiRegion.getRegion();

Get province

var province = thaiRegion.getProvince();

Get by provide RegionType:

var province = thaiRegion.getProvince(region: RegionType.central);

Get district

var district = thaiRegion.getDistrict();

Get by provide province ID:

var district = thaiRegion.getDistrict(provinceId: 'XX');

Get sub-district

var subDistrict = thaiRegion.getSubDistrict();

Get by provide district ID:

var subDistrict = thaiRegion.getSubDistrict(districtId: 'XXXX');

Method/Attribute in data models

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>

Changelog

Refer to the Changelog to get all release notes.

About

The flutter project for provide province, district, sub-district in thailand.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages