drawPoly method

Graphics drawPoly(
  1. List<GPoint> points, [
  2. bool closePolygon = true
])

Draws a complex polygon from a List of points that contains the vertices of the polygon Is similar to use moveTo and lineTo methods but in one command. closePolygon will close the shape, defaults to true.

The method returns this, which allows for method chaining.

See also:

Implementation

Graphics drawPoly(List<GPoint> points, [bool closePolygon = true]) {
  final len = points.length;
  final list = List<Offset>.filled(len, Offset.zero);
  for (var i = 0; i < len; ++i) {
    list[i] = points[i].toNative();
  }
  _path!.addPolygon(list, closePolygon);
  return this;
}