straightPath method

Path straightPath()

Returns a closed Path with coordinates connected with straight line segments.

Implementation

Path straightPath() {
  Path path = Path();
  // create path starting from point 0, ...
  path.moveTo(coords[0].x, coords[0].y);
  for (int i = 1; i < coords.length; i++) {
    path.lineTo(coords[i].x, coords[i].y);
  }
  // close path at starting point
  path.lineTo(coords[0].x, coords[0].y);
  return path;
}