TransitOptions class
Specifies the desired time of arrival/departure and/or desired
transit types and/or desired routing preference for transit
TravelMode.
May contain the following fields:
-
arrivalTime
- specifies the desired time of arrival for transit directions. You can specify eitherdepartureTime
orarrivalTime
, but not both. -
departureTime
- specifies the desired time of departure. The departure time may be specified in two cases: -
For requests where the travel mode is
transit
: You can optionally specify one ofdepartureTime
orarrivalTime
. If neither time is specified, thedepartureTime
defaults to now (that is, the departure time defaults to the current time). -
For requests where the travel mode is
driving
: You can specify thedepartureTime
to receive a route and trip duration (response field:durationInTraffic
) that take traffic conditions into account. ThedepartureTime
must be set to the current time or some time in the future. It cannot be in the past.
Note: If departure time is not specified, choice of route and duration are based on road network and average time-independent traffic conditions. Results for a given request may vary over time due to changes in the road network, updated average traffic conditions, and the distributed nature of the service. Results may also vary between nearly-equivalent routes at any time or frequency.
-
mode
- specifies one or more preferred modes of transit. This parameter may only be specified for transit directions. The parameter supports the following arguments: -
bus
indicates that the calculated route should prefer travel by bus. -
subway
indicates that the calculated route should prefer travel by subway. -
train
indicates that the calculated route should prefer travel by train. -
tram
indicates that the calculated route should prefer travel by tram and light rail. -
rail
indicates that the calculated route should prefer travel by train, tram, light rail, and subway. This is equivalent totransitMode=train|tram|subway
. -
routingPreference
- specifies preferences for transit routes. Using this parameter, you can bias the options returned, rather than accepting the default best route chosen by the API. This parameter may only be specified for transit directions. The parameter supports the following arguments: -
lessWalking
indicates that the calculated route should prefer limited amounts of walking. -
fewerTransfers
indicates that the calculated route should prefer a limited number of transfers.
Constructors
-
TransitOptions({DateTime? arrivalTime, DateTime? departureTime, List<
TransitMode> ? modes, TransitRoutingPreference? routingPreference}) -
const
Properties
- arrivalTime → DateTime?
-
Specifies the desired time of arrival for transit directions.
You can specify either
departureTime
orarrivalTime
, but not both.final - departureTime → DateTime?
-
Specifies the desired time of departure. The departure time
may be specified in two cases:
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
modes
→ List<
TransitMode> ? -
Specifies one or more preferred modes of transit. This parameter
may only be specified for transit directions. The parameter
supports the following arguments:
final
- routingPreference → TransitRoutingPreference?
-
Specifies preferences for transit routes. Using this parameter,
you can bias the options returned, rather than accepting the
default best route chosen by the API. This parameter may only
be specified for transit directions. The parameter supports the
following arguments:
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited