RoutePreferences class
Comprehensive route calculation configuration for customizing routing behavior.
RoutePreferences centralizes all route calculation options including transport mode, vehicle profiles, avoidance settings (motorways, tolls, ferries, unpaved roads), traffic handling, algorithm selection, result detail levels, and alternative route handling. Set preferences before calling RoutingService.calculateRoute to control how routes are computed.
Each transport mode supports specific profile configurations:
- carProfile for cars, including fuel type and vehicle mass
- truckProfile for trucks, with dimensions and axle load constraints
- bikeProfile for bicycles, supporting both standard and electric bikes
- pedestrianProfile for walking or wheelchair-accessible routes
Common preferences include routeType (fastest, shortest, economic), avoidMotorways, avoidTollRoads, avoidFerries, avoidUnpavedRoads, and avoidTraffic strategies. Public transport options include departure/arrival times via timestamp and algorithmType, transfer constraints, and sorting strategies. Emergency vehicle mode relaxes routing constraints.
See also:
- RoutingService.calculateRoute - Uses these preferences to compute routes.
- CarProfile - Car-specific routing constraints.
- TruckProfile - Truck-specific routing constraints.
- RouteTransportMode - Transport mode options.
Constructors
-
RoutePreferences({bool accurateTrackMatch = true, PTAlgorithmType algorithmType = PTAlgorithmType.departure, bool allowOnlineCalculation = true, bool alternativeRoutesBalancedSorting = true, RouteAlternativesSchema alternativesSchema = RouteAlternativesSchema.defaultSchema, double avoidBikingHillFactor = 0.5, bool avoidCarpoolLanes = false, bool avoidFerries = false, bool avoidMotorways = false, bool avoidTollRoads = false, TrafficAvoidance avoidTraffic = TrafficAvoidance.none, bool avoidTurnAroundInstruction = false, bool avoidUnpavedRoads = false, BikeProfileElectricBikeProfile? bikeProfile, bool buildConnections = false, BuildTerrainProfile buildTerrainProfile = const BuildTerrainProfile(), CarProfile? carProfile, DepartureHeading departureHeading = const DepartureHeading(), int emergencyVehicleExtraFreedomLevels = 0, bool emergencyVehicleMode = false, bool ignoreRestrictionsOverTrack = false, bool maximumDistanceConstraint = true, int maximumTransferTimeInMinutes = 300, int maximumWalkDistance = 5000, int minimumTransferTimeInMinutes = 1, RoutePathAlgorithm pathAlgorithm = RoutePathAlgorithm.ml, RoutePathAlgorithmFlavor pathAlgorithmFlavor = RoutePathAlgorithmFlavor.magicLane, PedestrianProfile pedestrianProfile = PedestrianProfile.walk, RouteResultDetails resultDetails = RouteResultDetails.full, List<
int> routeGroupIdsEarlierLater = const <int>[], List<int> routeRanges = const <int>[], int routeRangesQuality = 100, RouteResultType routeResultType = RouteResultType.path, RouteType routeType = RouteType.fastest, Set<RouteTypePreferences> routeTypePreferences = const <RouteTypePreferences>{RouteTypePreferences.none}, PTSortingStrategy sortingStrategy = PTSortingStrategy.bestTime, DateTime? timestamp, RouteTransportMode transportMode = RouteTransportMode.car, TruckProfile? truckProfile, bool useBikes = false, bool useWheelchair = false, bool isTrackResume = true, RoundTripParameters? roundTripParameters, int? roundTripRange, RangeType roundTripRangeType = RangeType.defaultType, int? roundTripRandomSeed}) - Creates a new set of routing preferences used to customize how routes are calculated.
-
RoutePreferences.fromJson(Map<
String, dynamic> json) -
Deserializes a JSON-compatible map to create an instance.
factory
Properties
- accurateTrackMatch ↔ bool
-
Enables accurate track matching for route-over-track computations.
getter/setter pair
- algorithmType ↔ PTAlgorithmType
-
Public transport algorithm type for determining departure or arrival time optimization.
getter/setter pair
- allowOnlineCalculation ↔ bool
-
Allows route calculation using online services when available.
getter/setter pair
- alternativeRoutesBalancedSorting ↔ bool
-
Enables balanced sorting for alternative route results.
getter/setter pair
- alternativesSchema ↔ RouteAlternativesSchema
-
Schema defining how alternative routes are generated and returned.
getter/setter pair
- avoidBikingHillFactor ↔ double
-
Hill avoidance factor for bicycle routes, ranging from 0.0 to 1.0.
getter/setter pair
- avoidCarpoolLanes ↔ bool
-
Avoids carpool/HOV lanes when calculating routes.
getter/setter pair
- avoidFerries ↔ bool
-
Avoids ferry crossings when calculating routes.
getter/setter pair
- avoidMotorways ↔ bool
-
Avoids motorways/highways when calculating routes.
getter/setter pair
- avoidTollRoads ↔ bool
-
Avoids toll roads when calculating routes.
getter/setter pair
- avoidTraffic ↔ TrafficAvoidance
-
Traffic avoidance strategy for route calculation.
getter/setter pair
- avoidTurnAroundInstruction ↔ bool
-
Avoids generating "Turnaround when possible" instructions during navigation.
getter/setter pair
- avoidUnpavedRoads ↔ bool
-
Avoids unpaved roads when calculating routes.
getter/setter pair
- bikeProfile ↔ BikeProfileElectricBikeProfile?
-
Bicycle routing profile for standard and electric bikes.
getter/setter pair
- buildConnections ↔ bool
-
Enables building route segment connections metadata.
getter/setter pair
- buildTerrainProfile ↔ BuildTerrainProfile
-
Controls whether terrain profile data is generated for the route.
getter/setter pair
- carProfile ↔ CarProfile?
-
Car routing profile with vehicle-specific constraints.
getter/setter pair
- departureHeading ↔ DepartureHeading
-
Departure heading and accuracy for route calculation.
getter/setter pair
- emergencyVehicleExtraFreedomLevels ↔ int
-
Extra freedom levels for emergency vehicle routing constraints in a
packed integer format.
getter/setter pair
- emergencyVehicleMode ↔ bool
-
Enables emergency vehicle routing mode with relaxed constraints.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- ignoreRestrictionsOverTrack ↔ bool
-
Ignores map restrictions during route-over-track calculations.
getter/setter pair
- isTrackResume ↔ bool
-
Track resume mode for path-based routing with track landmarks.
getter/setter pair
- maximumDistanceConstraint ↔ bool
-
Enables maximum distance constraints based on transport mode.
getter/setter pair
- maximumTransferTimeInMinutes ↔ int
-
Maximum transfer time between public transport connections, in minutes.
getter/setter pair
- maximumWalkDistance ↔ int
-
Maximum walking distance for public transport routes, in meters.
getter/setter pair
- minimumTransferTimeInMinutes ↔ int
-
Minimum transfer time between public transport connections, in minutes.
getter/setter pair
- pathAlgorithm ↔ RoutePathAlgorithm
-
Path calculation algorithm to use for routing.
getter/setter pair
- pathAlgorithmFlavor ↔ RoutePathAlgorithmFlavor
-
Flavor variant of the selected path algorithm.
getter/setter pair
- pedestrianProfile ↔ PedestrianProfile
-
Pedestrian routing profile for walking and wheelchair accessibility.
getter/setter pair
- resultDetails ↔ RouteResultDetails
-
Level of detail to include in route calculation results.
getter/setter pair
- roundTripParameters ↔ RoundTripParameters?
-
Set parameters for roundtrip feature.
getter/setter pair
- roundTripRandomSeed ↔ int?
-
Get roundtrip random seed.
getter/setter pair
- roundTripRange ↔ int?
-
Get roundtrip range (see roundTripParameters for explanation of how the units work).
getter/setter pair
- roundTripRangeType ↔ RangeType
-
Get roundtrip range type.
getter/setter pair
-
routeGroupIdsEarlierLater
↔ List<
int> -
Route group IDs for earlier/later trip calculations in public transport.
getter/setter pair
-
routeRanges
↔ List<
int> -
Route range values for isoline/isochrone calculations.
getter/setter pair
- routeRangesQuality ↔ int
-
Quality level for route range calculations, from 0 to 100.
getter/setter pair
- routeResultType ↔ RouteResultType
-
Route result type indicating the format of the returned route.
getter/setter pair
- routeType ↔ RouteType
-
Primary route optimization criterion.
getter/setter pair
-
routeTypePreferences
↔ Set<
RouteTypePreferences> -
Additional route type preference flags.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sortingStrategy ↔ PTSortingStrategy
-
Public transport route sorting strategy.
getter/setter pair
- timestamp ↔ DateTime?
-
Local departure or arrival time for public transport routing.
getter/setter pair
- transportMode ↔ RouteTransportMode
-
Primary transport mode for route calculation.
getter/setter pair
- truckProfile ↔ TruckProfile?
-
Truck routing profile with vehicle-specific constraints.
getter/setter pair
- useBikes ↔ bool
-
Ensures bike accessibility for public transport routes.
getter/setter pair
- useWheelchair ↔ bool
-
Ensures wheelchair accessibility for public transport routes.
getter/setter pair
- vehicleRegistration → VehicleRegistration?
-
Returns the vehicle registration profile for the current transport mode.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Serializes this instance to a JSON-compatible map.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited