dach_locator 1.1.2 copy "dach_locator: ^1.1.2" to clipboard
dach_locator: ^1.1.2 copied to clipboard

Given a zip code of Germany, Austria or Switzerland the region is resolved.

dach_locator #

pub package Build Status

Given a zip code of Germany, Austria or Switzerland the region is resolved.

Features #

  • Insert a zip code and get region and country as result (no connection required)
  • If possible add countryCode ('DE', 'CH' or 'AT'), otherwise country is automatically resolved.

Usage #

If you want to get the region of a specific country (Austria, Germany, Switzerland), use the methods getAustriaRegionCode, getGermanRegionCode, getSwitzerlandRegionCode. Internally a lookup for that zip code is executed for each country.

For ease of use you can instead use method getRegion. It returns null (no match) or a Region instance. Optionally you can pass a countryCode ('DE', 'CH' or 'AT'), then getRegion works identically to getAustriaRegionCode, getGermanRegionCode or getSwitzerlandRegionCode. If countryCode is not passed, the method tries to resolve the country of the zip code automatically.

  Set<Region> _resolveRegion(String zipCode, {String? countryCode}) {
  if (int.tryParse(zipCode) != null && zipCode.length > 3 && zipCode.length < 6) {
    return getRegion(zipCode, countryCode: countryCode);
  }
  return {};
}
2
likes
160
pub points
59%
popularity

Publisher

verified publisherehwplus.com

Given a zip code of Germany, Austria or Switzerland the region is resolved.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on dach_locator