getTimeDistance method

TimeDistance getTimeDistance({
  1. bool activePart = true,
})

Returns time and distance metrics for the route or a segment.

When called on a route, returns aggregated metrics (total distance and estimated travel time). When called on a segment (via the corresponding API), the segment's metrics are returned.

Parameters

  • activePart: If true, consider only the active portion of the route; otherwise return metrics for the entire route. Defaults to true.

Returns

  • A TimeDistance object containing distance (meters) and time (seconds) information.

Implementation

TimeDistance getTimeDistance({final bool activePart = true}) {
  final OperationResult resultString = objectMethod(
    pointerId,
    'RouteBase',
    'getTimeDistance',
    args: activePart,
  );

  return TimeDistance.fromJson(resultString['result']);
}