callPainter method

FutureOr<bool> callPainter()

Calls the painter, forcing a render operation.

Implementation

FutureOr<bool> callPainter() {
  if (_painting) return false;
  _painting = true;

  checkDimension();

  try {
    final painter = this.painter;

    onPrePaint();

    painter.clear(this);

    final ret = painter.isLoadingResources
        ? _callPainterLoading()
        : _callPainterImpl();

    if (ret is Future<bool>) {
      return ret.whenComplete(() {
        _painting = false;
        _callOnPosPaint();
      });
    } else {
      _painting = false;
      _callOnPosPaint();
      return ret;
    }
  } catch (e) {
    _painting = false;
    _callOnPosPaint();
    rethrow;
  }
}