arc method

Graphics arc(
  1. double cx,
  2. double cy,
  3. double radius,
  4. double startAngle,
  5. double sweepAngle, [
  6. bool moveTo = false,
])

Draws an arc of a circle.

The circle is specified by its center cx, cy and radius. The arc starts at startAngle and sweeps sweepAngle degrees (in radians).

If moveTo is true, the path will start at the beginning of the arc instead of connecting it to the previous path.

See also:

  • Path.arcTo, the method used to draw the arc.
  • Path.addArc, the method used to add the arc to the current path.

Implementation

Graphics arc(
  double cx,
  double cy,
  double radius,
  double startAngle,
  double sweepAngle, [
  bool moveTo = false,
]) {
  if (sweepAngle == 0) {
    return this;
  }
  if (!moveTo) {
    _path!.arcTo(
      Rect.fromCircle(center: Offset(cx, cy), radius: radius),
      startAngle,
      sweepAngle,
      false,
    );
  } else {
    _path!.addArc(
      Rect.fromCircle(center: Offset(cx, cy), radius: radius),
      startAngle,
      sweepAngle,
    );
  }
  return this;
}