swapPoints method
Swaps start and destination, then recalculates the route.
Implementation
Future<void> swapPoints() async {
if (_endPoint?.id != null) {
_mapManager!.unselectPOIById(_endPoint!.id!);
}
final temp = _endPoint;
_endPoint = _startPoint;
_startPoint = temp;
_isCalculating = true;
_notify();
_mapManager!.removeItinerary();
_mapManager!.addItinerary(
origin: _startPoint!.coordinate,
destination: _endPoint!.coordinate,
searchRules: ItinerarySearchRules(ruleNames: _selectedRuleNames),
);
if (_startPoint?.id != null) {
_startPointType = ItineraryStartPointType.pointOfInterest;
} else {
_startPointType = ItineraryStartPointType.mapCenter;
}
_notify();
}