disposeStepTurnArrows method

Future<void> disposeStepTurnArrows()

Fully removes step arrow layers and source. Call on route dismissal/disposal only.

Implementation

Future<void> disposeStepTurnArrows() async {
  try {
    final layerIds = await _controller.getLayerIds();
    if (layerIds.contains("step-arrows-symbol-layer")) {
      await _controller.removeLayer("step-arrows-symbol-layer");
    }
    if (layerIds.contains("step-arrows-line-layer")) {
      await _controller.removeLayer("step-arrows-line-layer");
    }
    if (layerIds.contains("step-arrows-casing-layer")) {
      await _controller.removeLayer("step-arrows-casing-layer");
    }
    final sourceIds = await _controller.getSourceIds();
    if (sourceIds.contains("step-arrows-source")) {
      await _controller.removeSource("step-arrows-source");
    }
  } catch (_) {} finally {
    _stepArrowsAdded = false;
  }
}