location_name 1.0.0 copy "location_name: ^1.0.0" to clipboard
location_name: ^1.0.0 copied to clipboard

To get the name of the place concerning the location coordinates.

The main aim of this package is to ease the development process when the current place name is to be taken.


Features #

This package can do the following

  • Get the user location access.
  • Get the name of the location with the coordinates.
  • Provide  human-understandable error messages.

Getting started #

Import the package and follow the instructions in the Usage section.


Usage #

For example, you need to get the location name; below are the steps to be followed..

  1. Create an object for the LocationName Class final LocationName locationName = LocationName();
  2. Call the getLocationPermission() function that gives a future and then chain it to getAddress() function which gives the place name.
locationName.getLocationPermission().then((dataMap) {
  if (dataMap["hasError"]) {
    ScaffoldMessenger.of(context).showSnackBar(
        sb5Sec(textContent: Text(dataMap["eMsg"].toString())));
  } else {
    locationName
        .getAddress(
            lat: dataMap["data"]["latitude"],
            lon: dataMap["data"]["longitude"])
        .then((addressMap) {
      locationTEC.text = addressMap["data"];
    });
  }
});

In the above exaple the addressMap["data"] extracts data in the below format

"Chennai, Tamil Nadu, India"

Functions available #

The LocationName Class contains he below functions

getLocationPermission(): Future responsible for handeling permission - hasError : This flag denotes that there is an issue with the api called

- `eMsg` : The actual error message

getAddress(): Future responsible for retriving location name - hasError : This flag denotes that there is an issue with the api called

- `eMsg` : The actual error message
- `data` : If `hasError` is set to `false`, this field contaings the place name. This field is an abstract of the class `Placemark`

Next Goals: #

  • ❌ To expose the Placemark
    • Users can build the name with the meta data.
  • ❌ To implement stream of place name
    • This allows a stream of name when location changes

Now that the possibilities are endless. Play with this package. :grinning:
0
likes
40
points
10
downloads

Publisher

unverified uploader

Weekly Downloads

To get the name of the place concerning the location coordinates.

Homepage

License

unknown (license)

Dependencies

geocoding, location, path

More

Packages that depend on location_name