TrafficModel class

Specifies the assumptions to use when calculating time in traffic. This setting affects the value returned in the durationInTraffic field in the response, which contains the predicted time in traffic based on historical averages. The trafficModel parameter may only be specified for driving directions where the request includes a departureTime.

The available values for this parameter are:

  • bestGuess indicates that the returned durationInTraffic should be the best estimate of travel time given what is known about both historical traffic conditions and live traffic. Live traffic becomes more important the closer the departureTime is to now.
  • pessimistic indicates that the returned durationInTraffic should be longer than the actual travel time on most days, though occasional days with particularly bad traffic conditions may exceedthis value.
  • optimistic indicates that the returned durationInTraffic should be shorter than the actual travel time on most days, though occasional days with particularly good traffic conditions may be faster than this value.

Constructors

TrafficModel(String _name)
const

Properties

hashCode int
The hash code for this object.
no setterinherited
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

Static Properties

values List<TrafficModel>
final

Constants

bestGuess → const TrafficModel
Indicates that the returned durationInTraffic should be the best estimate of travel time given what is known about both historical traffic conditions and live traffic. Live traffic becomes more important the closer the departureTime is to now.
optimistic → const TrafficModel
Indicates that the returned durationInTraffic should be shorter than the actual travel time on most days, though occasional days with particularly good traffic conditions may be faster than this value.
pessimistic → const TrafficModel
Indicates that the returned durationInTraffic should be longer than the actual travel time on most days, though occasional days with particularly bad traffic conditions may exceedthis value.