asPath method

  1. @override
Path asPath()
override

Converts the shape to a Path object, suitable for rendering on a canvas. If a particular geometric primitive cannot be represented as a Path faithfully, an approximate path can be returned.

Implementation

@override
Path asPath() {
  final path = Path()..moveTo(_vertices.last.x, _vertices.last.y);
  for (final vertex in _vertices) {
    path.lineTo(vertex.x, vertex.y);
  }
  return path..close();
}