location_navigator 1.0.0
location_navigator: ^1.0.0 copied to clipboard
A Flutter package to navigate and find nearby places using location.
π Location Navigator #
A Flutter package to find and navigate nearby places (e.g. Mosques, Hospitals, Hotels, Restaurants, Pharmacies) using OpenStreetMap data and Geolocator.
β¨ Features #
- π Get user's current location with permission handling.
- π Show nearby Mosques, Hospitals, Restaurants, Hotels, Pharmacies etc.
- π Dropdown to select place type (amenity).
- π Search box to filter nearby places by name.
- π Places sorted automatically by distance.
- πΊοΈ Built-in Map view with markers and navigation.
- π¨ Simple Material Design with teal theme.
βοΈ How It Works #
-
Get Current Location
The package uses geolocator to request location permission and fetch the user's latitude & longitude. -
Fetch Nearby Places
It calls OpenStreetMap (Overpass API) through a service (PlaceService) to search for nearby places based on amenity type (e.g. hospital, mosque, hotel). -
Distance Calculation
Each place's distance from the user is calculated usingGeolocator.distanceBetween(...). -
Sorting & Filtering
- If the user selects a category (Hospital, Mosque etc.), results are filtered by that.
- If the user types in the search box, results are filtered by name.
- Finally, places are sorted by nearest distance.
-
Display Results
- A ListView shows the places with name, type, and distance.
- Tapping an item opens a Map screen (powered by flutter_map) where the selected place and user location are displayed.
π¦ Installation #
Add the dependency in your pubspec.yaml:
dependencies:
location_navigator: ^1.0.0
Then run:
flutter pub get