distance property

double distance

Sums up all the distances on the path

Path path = new Path.from(route); print(path.distance);

Implementation

double get distance {
  List<T> coords = coordinates.toList();
  double length = 0.0;

  for (int index = 0; index < coords.length - 1; index++) {
    length += getDistance(coords[index], coords[index + 1]);
  }

  return round(length);
}