clearRoutes method
Implementation
Future<void> clearRoutes() async {
await disposeStepTurnArrows();
if (_routeSourceAdded) {
try {
await _controller.removeLayer("route-main-layer");
await _controller.removeLayer("route-casing-layer");
await _controller.removeSource("route-source");
} catch (_) {
// Layers or source may already be removed
}
_routeSourceAdded = false;
}
// Also clear legacy annotation lines in case any exist
await _controller.clearLines();
}