end method

bool end({
  1. Offset? point,
})

Implementation

bool end({Offset? point}) {
  if (point != null) {
    add(point);
  }

  _temp = null;

  if (_points.isEmpty) {
    return false;
  }

  if (_points.length < 3) {
    if (_points.length == 1) {
      _addDot(CubicLine(
        start: _points[0],
        cpStart: _points[0],
        cpEnd: _points[0],
        end: _points[0],
      ));
    } else {
      _addLine(CubicLine(
        start: _points[0],
        cpStart: _points[0],
        cpEnd: _points[1],
        end: _points[1],
      ));
    }
  } else {
    final i = _points.length - 3;

    final end = CubicLine(
      start: _points[i + 1],
      cpStart: _points[i + 1],
      cpEnd: _points[i + 2],
      end: _points[i + 2],
    );

    _addLine(end);
  }

  return true;
}