getCurrentLocation method
Get the user's current location
Implementation
Future<OlaLatLng?> getCurrentLocation() async {
try {
final result = await _channel.invokeMethod('getCurrentLocation');
if (result != null && result is Map) {
final latitude = result['latitude'] as double?;
final longitude = result['longitude'] as double?;
if (latitude != null && longitude != null) {
return OlaLatLng(latitude, longitude);
}
}
return null;
} catch (e) {
debugPrint('Error getting current location: $e');
return null;
}
}