location_finder
A Flutter package to fetch the current location with detailed address, city, state, and pincode information, including proper permission handling.
Authors
Support Device
| Android | IOS |
|---|---|
| ✅ | ✅ |
Features
• Fetch current location (Latitude & Longitude).
• Get complete address (Street, City, State).
• Retrieve structured data like City, State, and Postal Code.
• Graceful permission handling for Android and iOS.
Add the following line to your pubspec.yaml under dependencies
dependencies:location_finder:0.0.1
Ensure location permissions are granted on device.
Android: Add the following in AndroidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
iOS: Add the following in Info.plist:
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your location is needed to fetch current address details.</string>
Example
import 'package:location_finder/location_finder.dart';
Future<void> requestLocation() async {
LocationDetails? details = await LocationFinder.init();
if (details != null) {
setState(() {
_currentLocation = details;
});
print("Location fetched: ${details.toString()}");
} else {
print("Could not fetch location or permission denied.");
}}
Hi, I'm Amit Chandra! 👋
🚀 About Me
I'm a Flutter Mobile Application Developer and Backend Developer