DirectionsRoute class

When the Directions API returns results, it places them within a (JSON) routes array. Even if the service returns no results (such as if the origin and/or destination doesn't exist) it still returns an empty routes array. (XML responses consist of zero or more

Each element of the routes array contains a single result from the specified origin and destination. This route may consist of one or more legs depending on whether any waypoints were specified. As well, the route also contains copyright and warning information which must be displayed to the user in addition to the routing information.

Each route within the routes field may contain the following fields:

  • summary contains a short textual description for the route, suitable for naming and disambiguating the route from alternatives.
  • legs contains an array which contains information about a leg of the route, between two locations within the given route. A separate leg will be present for each waypoint or destination specified. (A route with no waypoints will contain exactly one leg within the legs array.) Each leg consists of a series of steps. (See Leg.)
  • waypointOrder contains an array indicating the order of any waypoints in the calculated route. This waypoints may be reordered if the request was passed optimize:true within its waypoints parameter.
  • overviewPolyline contains a single points object that holds an encoded polyline representation of the route. This polyline is an approximate (smoothed) path of the resulting directions.
  • bounds contains the viewport bounding box of the overviewPolyline.
  • copyrights contains the copyrights text to be displayed for this route. You must handle and display this information yourself.
  • warnings contains an array of warnings to be displayed when showing these directions. You must handle and display these warnings yourself.
  • fare: If present, contains the total fare (that is, the total ticket costs) on this route. This property is only returned for transit requests and only for routes where fare information is available for all transit legs. The information includes:
  • currency: An ISO 4217 currency code indicating the currency that the amount is expressed in.
  • value: The total fare amount, in the currency specified above.
  • text: The total fare amount, formatted in the requested language.

Note: The Directions API only returns fare information for requests that contain either an API key or a client ID and digital signature.

Constructors

DirectionsRoute({GeoCoordBounds? bounds, String? copyrights, List<Leg>? legs, OverviewPolyline? overviewPolyline, String? summary, List<String?>? warnings, List<num?>? waypointOrder, Fare? fare})
const
DirectionsRoute.fromMap(Map<String, dynamic> map)
factory

Properties

bounds GeoCoordBounds?
Contains the viewport bounding box of the overviewPolyline.
final
copyrights String?
Contains the copyrights text to be displayed for this route. You must handle and display this information yourself.
final
fare Fare?
Contains the total fare (that is, the total ticket costs) on this route. This property is only returned for transit requests and only for routes where fare information is available for all transit legs. The information includes:
final
hashCode int
The hash code for this object.
no setterinherited
legs List<Leg>?
Contains an array which contains information about a leg of the route, between two locations within the given route. A separate leg will be present for each waypoint or destination specified. (A route with no waypoints will contain exactly one leg within the legs array.) Each leg consists of a series of steps. (See Leg.)
final
overviewPath List<GeoCoord>?
no setter
overviewPolyline OverviewPolyline?
Contains a single points object that holds an encoded polyline representation of the route. This polyline is an approximate (smoothed) path of the resulting directions.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
summary String?
Contains a short textual description for the route, suitable for naming and disambiguating the route from alternatives.
final
warnings List<String?>?
Contains an array of warnings to be displayed when showing these directions. You must handle and display these warnings yourself.
final
waypointOrder List<num?>?
Contains an array indicating the order of any waypoints in the calculated route. This waypoints may be reordered if the request was passed optimize:true within its waypoints parameter.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited