TransitDetails class

Transit directions return additional information that is not relevant for other modes of transportation. These additional properties are exposed through the transit object, returned as a field of an element in the steps array. From the TransitDetails object you can access additional information about the transit stop, transit line and transit agency.

A transit object may contain the following fields:

  • arrivalStop and departureStop contains information about the stop/station for this part of the trip. Stop details can include:

  • name the name of the transit station/stop. eg. "Union Square".

  • location the location of the transit station/stop, represented as a lat and lng field.

  • arrivalTime and departureTime contain the arrival or departure times for this leg of the journey, specified as the following three properties:

  • text the time specified as a string. The time is displayed in the time zone of the transit stop.

  • value the time specified as Unix time, or seconds since midnight, January 1, 1970 UTC.

  • timeZone contains the time zone of this station. The value is the name of the time zone as defined in the IANA Time Zone Database, e.g. "America/New_York".

  • headsign specifies the direction in which to travel on this line, as it is marked on the vehicle or at the departure stop. This will often be the terminus station.

  • headway specifies the expected number of seconds between departures from the same stop at this time. For example, with a headway value of 600, you would expect a ten minute wait if you should miss your bus.

  • numStops contains the number of stops in this step, counting the arrival stop, but not the departure stop. For example, if your directions involve leaving from Stop A, passing through stops B and C, and arriving at stop D, numStops will return 3.

  • tripShortName contains the text that appears in schedules and sign boards to identify a transit trip to passengers. The text should uniquely identify a trip within a service day. For example, "538" is the tripShortName of the Amtrak train that leaves San Jose, CA at 15:10 on weekdays to Sacramento, CA.

  • line contains information about the transit line used in this step, and may include the following properties:

  • name contains the full name of this transit line. eg. "7 Avenue Express".

  • shortName contains the short name of this transit line. This will normally be a line number, such as "M7" or "355".

  • color contains the color commonly used in signage for this transit line. The color will be specified as a hex string such as: #FF0033.

  • agencies is an array containing a single TransitAgency object. The DirectionsTransitAgency] object provides information about the operator of the line, including the following properties:

    • name contains the name of the transit agency.
    • phone contains the phone number of the transit agency.
    • url contains the URL for the transit agency.

You must display the names and URLs of the transit agencies servicing the trip results.

  • url contains the URL for this transit line as provided by the transit agency.
  • icon contains the URL for the icon associated with this line.
  • textColor contains the color of text commonly used for signage of this line. The color will be specified as a hex string.
  • vehicle contains the type of vehicle used on this line. This may include the following properties:
    • name contains the name of the vehicle on this line. eg. "Subway."
    • type contains the type of vehicle that runs on this line. See the Vehicle Type documentation for a complete list of supported values.
    • icon contains the URL for an icon associated with this vehicle type.
    • localIcon contains the URL for the icon associated with this vehicle type, based on the local transport signage.

Constructors

TransitDetails({TransitStop? arrivalStop, TransitStop? departureStop, Time? arrivalTime, Time? departureTime, String? headsign, num? headway, TransitLine? line, num? numStops, String? tripShortName})
const
TransitDetails.fromMap(Map<String, dynamic> map)
factory

Properties

arrivalStop TransitStop?
Contains information about the stop/station for this part of the trip. Stop details can include:
final
arrivalTime Time?
Contain the arrival times for this leg of the journey, specified as the following three properties:
final
departureStop TransitStop?
Contains information about the stop/station for this part of the trip. Stop details can include:
final
departureTime Time?
Contain the departure times for this leg of the journey, specified as the following three properties:
final
hashCode int
The hash code for this object.
no setterinherited
headsign String?
Specifies the direction in which to travel on this line, as it is marked on the vehicle or at the departure stop. This will often be the terminus station.
final
headway num?
Specifies the expected number of seconds between departures from the same stop at this time. For example, with a headway value of 600, you would expect a ten minute wait if you should miss your bus.
final
line TransitLine?
Contains information about the transit line used in this step.
final
numStops num?
Contains the number of stops in this step, counting the arrival stop, but not the departure stop. For example, if your directions involve leaving from Stop A, passing through stops B and C, and arriving at stop D, numStops will return 3.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tripShortName String?
Contains the text that appears in schedules and sign boards to identify a transit trip to passengers. The text should uniquely identify a trip within a service day. For example, "538" is the tripShortName of the Amtrak train that leaves San Jose, CA at 15:10 on weekdays to Sacramento, CA.
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