render method

  1. @override
void render()
override

Recalculates layout and paints the widget tree to the internal buffer.

Implementation

@override
void render() {
  if (_isDisposed) return;
  _drawScheduled = false;
  final rootElement = _rootElement;
  final buffer = _currentBuffer;
  if (rootElement == null || buffer == null) return;

  // Rebuild the element tree to consume any new state modifications.
  _buildOwner?.buildScope();

  buffer.clear();
  // Render the rebuilt element tree on our double buffer canvas.
  rootElement.layout(BoxConstraints.tight(Size(_width, _computedHeight)));
  rootElement.paint(buffer, Offset.zero);
  _paintDebugOverlays(buffer, rootElement);

  onFramePainted?.call(buffer);
  onNeedVisualUpdate?.call();

  if (mode == ExecutionMode.standalone) {
    _flushStandaloneBuffer(buffer);
  }
}