ph_address_finder 5.0.1 copy "ph_address_finder: ^5.0.1" to clipboard
ph_address_finder: ^5.0.1 copied to clipboard

Offline Flutter package for Philippine PSA/PSGC and PCIC address lookups with bundled province, municipality, and barangay data.

example/main.dart

import 'package:flutter/widgets.dart';
import 'package:ph_address_finder/ph_address_finder.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  final psaProvinces = await AddressService.getProvincesByRegion(
    regionSubCode: 'III-A',
  );
  final psaMunicipalities = await AddressService.getMunicipalitiesByProvince(
    provinceCode: '23',
  );
  final psaBarangays = await AddressService.getBarangaysByMunicipality(
    provinceCode: '23',
    municipalityCode: '1',
  );
  final psaAddress = await AddressService.getAddress(
    provinceCode: '23',
    municipalityCode: '1',
    barangayCode: '1',
  );

  final pcicRegionNumbers = await PcicAddressService.getRegionNumbers();
  final pcicRegionOptions = await PcicAddressService.getRegionOptions(
    regionNo: '1',
  );
  final pcicProvinces = await PcicAddressService.getProvinces(
    regionNo: '1',
    regionOption: '3A',
  );
  final aurora = pcicProvinces.firstWhere(
    (province) => province['provinceName'] == 'Aurora',
  );
  final pcicMunicipalities = await PcicAddressService.getMunicipalities(
    regionNo: '1',
    provinceCode: aurora['provinceCode'].toString(),
    provinceId: aurora['provinceId'].toString(),
  );
  final baler = pcicMunicipalities.firstWhere(
    (municipality) => municipality['municipalityName'] == 'Baler',
  );
  final pcicBarangays = await PcicAddressService.getBarangays(
    regionNo: '1',
    provinceCode: aurora['provinceCode'].toString(),
    municipalityCode: baler['municipalityCode'].toString(),
    provinceId: aurora['provinceId'].toString(),
    municipalityId: baler['municipalityId'].toString(),
  );
  final pcicAddress = await PcicAddressService.getAddress(
    regionNo: '1',
    provinceCode: aurora['provinceCode'].toString(),
    municipalityCode: baler['municipalityCode'].toString(),
    barangayCode: pcicBarangays.first['barangayCode'].toString(),
  );

  debugPrint('PSA provinces in Region III-A: ${psaProvinces.length}');
  debugPrint('PSA municipalities in Aurora: ${psaMunicipalities.length}');
  debugPrint('PSA distinct barangays in Baler: ${psaBarangays.length}');
  debugPrint('PSA address result: $psaAddress');
  debugPrint('PCIC region numbers: $pcicRegionNumbers');
  debugPrint('PCIC region options for RegionNo 1: $pcicRegionOptions');
  debugPrint('PCIC provinces for region option 3A: ${pcicProvinces.length}');
  debugPrint('PCIC municipalities in Aurora: ${pcicMunicipalities.length}');
  debugPrint('PCIC barangays in Baler: ${pcicBarangays.length}');
  debugPrint('PCIC address result: $pcicAddress');
}
0
likes
150
points
329
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Offline Flutter package for Philippine PSA/PSGC and PCIC address lookups with bundled province, municipality, and barangay data.

Repository (GitHub)
View/report issues

Topics

#philippines #address #psgc #pcic #offline

License

MIT (license)

Dependencies

flutter

More

Packages that depend on ph_address_finder