postal_jp 1.0.5
postal_jp: ^1.0.5 copied to clipboard
A Dart package for retrieving Japanese postal address information from a postal code.
flutter_postal_jp #
I have published an alternative package that uses Japan Post Office APIs. I recommend using that instead. The package is available here.
A Dart package for retrieving Japanese postal address information from a postal code.
This package utilizes the Zip Cloud web service.

Features #
- Retrieve address information (prefecture, city, town) based on a 7-digit Japanese postal code.
- 7桁の日本の郵便番号から住所情報(都道府県、市区町村)を取得します。
- Provides
PostalCodeServiceto fetch data from an external API.- 外部APIからデータを取得する
PostalCodeServiceを提供します。
- 外部APIからデータを取得する
- Returns data as
AddressInfoobjects, including Japanese address components and kana readings.- 日本語の住所構成要素とかな読みを含む
AddressInfoオブジェクトとしてデータを返します。
- 日本語の住所構成要素とかな読みを含む
- Handles API errors and returns
ApiFailurewith error messages.- APIエラーを処理し、エラーメッセージとともに
ApiFailureを返します。
- APIエラーを処理し、エラーメッセージとともに
Getting started #
-
Add the dependency to your
pubspec.yamlfile:dependencies: postal_jp: ^<latest_version> # Replace with the latest version -
Install the package:
flutter pub get
Usage #
import 'package:postal_jp/postal_jp.dart';
void main() async {
final service = PostalJP();
final result = await service.getAddress(postalCode: '0790177');
switch (result) {
case ApiSuccess(data: var addressInfoList):
for (var address in addressInfoList) {
print(
'Address: ${address.address1} ${address.address2} ${address.address3}',
);
}
case ApiFailure():
print('Error: ${result.error}');
}
}