duration method

Duration? duration()

Travel time from the current position to the end of the route.

Implementation

Duration? duration() {
  final routePosition = this.routePosition;
  final endPosition = route.route.geometry.last?.point;

  if (routePosition == null || endPosition == null) {
    return null;
  }

  final duration = dynamicRouteInfo.traffic.durations
      .calculateDuration(routePosition, endPosition);

  return duration;
}