getCurrentLocationWithAddress method
Get current location with full address details using reverse geocoding
Implementation
Future<LocationModel?> getCurrentLocationWithAddress({
LocationAccuracy accuracy = LocationAccuracy.high,
Duration? timeLimit,
String? localeIdentifier,
}) async {
try {
// Get coordinates first
LocationModel? location = await getCurrentLocation(
accuracy: accuracy,
timeLimit: timeLimit,
);
if (location == null) return null;
// Get address from coordinates
return await getAddressFromCoordinates(
location.latitude,
location.longitude,
localeIdentifier: localeIdentifier,
);
} catch (e) {
throw Exception('Failed to get location with address: $e');
}
}