Flutter Package that provides methods for converting between geographic coordinates and addresses.
- Reverse geocoding: The library provides methods to get the address of a given geographic coordinate.
- Address suggestions: The library provides methods to get address suggestions for a given address.
- Support for multiple languages: The methods accept an optional Locale parameter, which can be used to specify the language in which the address information should be retrieved. The default language is English.
- Support for multiple address formats: The methods accept an optional AddressFormat parameter, which can be used to specify the address format in which the address information should be retrieved.
Add this to your package's pubspec.yaml file:
dependencies:
geocoding_resolver: <lastest>
The GeoCoder class is implemented as a singleton, with a factory constructor that returns the same instance of the class every time it is called.
GeoCoder geoCoder = GeoCoder();
Address address = await geoCoder.getAddressFromLatLng(
latitude: 37.4219999,
longitude: 32.0840575,
lang: Locale.en,
);
List<LookupAddress> addresses =
await geoCoder.getAddressSuggestions(
address: '1600 Amphitheatre Parkway, Mountain View, CA');
Address is a class that represents an address and its details. It has the following attributes:
Attribute | Type | Description |
---|---|---|
placeId | double | represents the unique identifier of the place. |
latitude | double | represents the latitude of the place. |
longitude | double | represents the longitude of the place. |
displayName | String | represents the display name of the place. |
boundingBox | list of strings | represents the bounding box of the place |
addressDetails | String | An instance of the AddressDetails class that holds more detailed information about the address. |
AddressDetails is a class that represents the details of an address. It has the following attributes:
Attribute | Type | Description |
---|---|---|
houseNumber | String | represents the house number of the address. |
road | String | represents the road of the address. |
neighbourhood | String | represents the neighborhood of the address. |
hamlet | String | represents the hamlet of the address. |
city | String | represents the city of the address |
state | String | represents the state of the address. |
postcode | String | represents the postal code of the address. |
country | String | represents the country of the address. |
countryCode | String | represents the country code of the address. |
http: ^0.13.5
the library uses the following APIs: