durationInTraffic property
Indicates the total duration of this leg. This value is an
estimate of the time in traffic based on current and historical
traffic conditions. See the trafficModel request parameter
for the options you can use to request that the returned value
is optimistic, pessimistic, or a best-guess estimate. The
duration in traffic is returned only if all of the following
are true:
- The request includes a valid API key, or a valid Google Maps
- Platform Premium Plan client ID and signature.
- The request does not include stopover waypoints. If the
request includes waypoints, they must be prefixed with via:to avoid stopovers.
- The request is specifically for driving directions—the
modeparameter is set todriving.
- The request includes a departureTimeparameter.
- Traffic conditions are available for the requested route.
The durationInTraffic contains the following fields:
- valueindicates the duration in seconds.
- textcontains a human-readable representation of the duration.
Implementation
final DirectionsDuration? durationInTraffic;