moveToCurrentLocation method

  1. @override
Future<void> moveToCurrentLocation()
override

Implementation

@override
Future<void> moveToCurrentLocation() async {
  try {
    var currentlocation = await checkLocationPermission();

    if (currentlocation == null) {
      throw Exception("Failed to get current location: 'Location not found'.");
    }
    await methodChannel.invokeMethod('moveToCurrentLocation', {'latitude': currentlocation.latitude, 'longitude': currentlocation.longitude});
  } on PlatformException catch (e) {
    throw Exception("Failed to move to current location: '${e.message}'.");
  }
}