finish method

PictureDetails finish()

Finishes drawing and returns the rendered PictureDetails of the drawing. The drawing is cached and on subsequent calls to this method, the cached drawing is returned.

This might throw a StateError if this PainterController is not attached to a widget, or the associated widget's Size.isEmpty.

Implementation

PictureDetails finish() {
  if (!isFinished()) {
    if (_widgetFinish != null) {
      _cached = _render(_widgetFinish!());
    } else {
      throw new StateError(
          'Called finish on a PainterController that was not connected to a widget yet!');
    }
  }
  return _cached!;
}