clearDestination method

Future<void> clearDestination()

Implementation

Future<void> clearDestination() async {
  if (_mapboxMap == null) return;

  try {
    if (_destinationMarker != null) {
      final annotationManager = await _mapboxMap!.annotations.createCircleAnnotationManager();
      await annotationManager.delete(_destinationMarker!);
      _destinationMarker = null;
    }

    // Clear the route as well
    await _clearRoute();

    _destinationPosition = null;
    _destinationName = "";
    notifyListeners();
  } catch (e) {
    print('Error clearing destination: $e');
  }
}