drawPolygon method
Draw a closed polygon provided in counter-clockwise order.
This implementation uses drawSegment to draw each side of the polygon.
Implementation
@override
void drawPolygon(List<Vector2> vertices, Color3i color) {
var paint = Paint()
..color = Color.fromARGB(255, color.r, color.g, color.b)
..style = PaintingStyle.stroke;
var path = Path()..moveTo(vertices[0].x, vertices[0].y);
for (var vertex in vertices) {
path.lineTo(vertex.x, vertex.y);
}
path.close();
canvas.drawPath(path, paint);
}