Last updated:
0 purchases
location name
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..
Create an object for the LocationName Class
final LocationName locationName = LocationName();
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"];
});
}
});
copied to clipboard
In the above exaple the addressMap["data"] extracts data in the below format
"Chennai, Tamil Nadu, India"
copied to clipboard
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
copied to clipboard
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`
copied to clipboard
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:
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.