drawStepTurnArrows method

Future<void> drawStepTurnArrows({
  1. required List<PowerRouteStep> steps,
  2. required List<LatLng> routeGeometry,
  3. int? selectedStepIndex,
  4. int? currentStepIndex,
  5. int maxUpcomingCount = 3,
  6. double? distanceTraveled,
  7. double? zoom,
  8. String? belowLayerId,
})

Renders compact white sub-polyline turn arrows focused tightly at turn corners (Google Maps Style). Mutex-serialized: if called while a previous draw is in progress, waits for it to finish first.

Implementation

Future<void> drawStepTurnArrows({
  required List<PowerRouteStep> steps,
  required List<LatLng> routeGeometry,
  int? selectedStepIndex,
  int? currentStepIndex,
  int maxUpcomingCount = 3,
  double? distanceTraveled,
  double? zoom,
  String? belowLayerId,
}) async {
  // Wait for any in-progress draw to complete first (mutex serialization)
  if (_drawLock != null) {
    await _drawLock;
  }

  // Create a new lock for this draw operation
  final completer = Completer<void>();
  _drawLock = completer.future;

  try {
    await _executeDrawStepTurnArrows(
      steps: steps,
      routeGeometry: routeGeometry,
      selectedStepIndex: selectedStepIndex,
      currentStepIndex: currentStepIndex,
      maxUpcomingCount: maxUpcomingCount,
      distanceTraveled: distanceTraveled,
      zoom: zoom,
      belowLayerId: belowLayerId,
    );
  } finally {
    // Release the lock
    completer.complete();
    if (_drawLock == completer.future) {
      _drawLock = null;
    }
  }
}