remainingDistance property
Calculates remaining distance (if current location and destination are known)
Implementation
double? get remainingDistance {
if (currentLocation == null || destination == null) return null;
// Safely extract coordinates with null checks
final lat1 = currentLocation!.coordinates.length > 1
? currentLocation!.coordinates[1]?.toDouble() ?? 0.0 : 0.0;
final lon1 = currentLocation!.coordinates.isNotEmpty
? currentLocation!.coordinates[0]?.toDouble() ?? 0.0 : 0.0;
final lat2 = destination!.coordinates.length > 1
? destination!.coordinates[1]?.toDouble() ?? 0.0 : 0.0;
final lon2 = destination!.coordinates.isNotEmpty
? destination!.coordinates[0]?.toDouble() ?? 0.0 : 0.0;
return _haversineDistance(lat1, lon1, lat2, lon2);
}