getPath method

Path getPath(
  1. Size newSize
)

convert this to a Path

Implementation

Path getPath(Size newSize) {
  resize(newSize);
  Path path = Path();
  if (nodes.isNotEmpty) {
    path.moveTo(nodes[0].position.dx, nodes[0].position.dy);
  }
  for (int i = 0; i < nodes.length; i++) {
    List<Offset> controlPoints = getNextPathControlPointsAt(i);
    if (controlPoints.length == 4) {
      path
        ..cubicTo(
            controlPoints[1].dx,
            controlPoints[1].dy,
            controlPoints[2].dx,
            controlPoints[2].dy,
            controlPoints[3].dx,
            controlPoints[3].dy);
    } else {
      path..lineTo(controlPoints[1].dx, controlPoints[1].dy);
    }
  }

  path.close();
  return path;
}