distance method

int? distance()

Distance from the current position to the end of the route.

Implementation

int? distance() {
  final routeDistance = route.route.geometry.length.millimeters;
  final currentDistance = routePosition?.distance.millimeters;

  if (currentDistance == null) {
    return null;
  }

  return routeDistance - currentDistance;
}