distanceToNextTurn property
Implementation
double get distanceToNextTurn {
if (_currentRoute == null || _currentRoute!.steps.isEmpty) return 0.0;
if (_currentStepIndex >= _currentRoute!.steps.length - 1) {
// Distance to destination
if (_currentLocation != null && _destination != null) {
return _currentLocation!.distanceTo(_destination!);
}
return 0.0;
}
// If we have a current step, return remaining distance in this step
if (currentStep != null) {
final totalStepDistance = currentStep!.distance;
final progressInStep = _calculateProgressInCurrentStep();
return totalStepDistance * (1 - progressInStep);
}
return 0.0;
}