getCurrentLocation method

  1. @override
Future<LocationData?> getCurrentLocation()
override

Implementation

@override
Future<LocationData?> getCurrentLocation() async {
  try {
    final result = await methodChannel.invokeMethod('getCurrentLocation');
    if (result != null) {
      return LocationData.fromMap(Map<String, dynamic>.from(result));
    }
    return null;
  } catch (e) {
    debugPrint('Error getting current location: $e');
    return null;
  }
}