render method

CellBuffer render({
  1. CellSize? size,
})

Renders the current tree into a fresh CellBuffer sized to size (defaulting to viewportSize). An explicit size also updates viewportSize and ambient MediaQuery, like a terminal resize.

Does not advance time or drain post-frame callbacks; use pump for a complete frame. Framework tests may use this partial phase after mountWidget to inspect layout or paint before callbacks run.

Implementation

CellBuffer render({CellSize? size}) {
  _assertNotDisposed('render');
  if (_root == null) {
    throw StateError(
      'FleuryTester.render called before pumpWidget; the tree is empty.',
    );
  }
  if (size != null) viewportSize = size;
  // Latch sampled input before producing the frame, as the runtime does.
  // With a ticker registered this is a no-op; the tick publishes instead.
  _publishFrameLatch();
  final buffer = CellBuffer(viewportSize);
  _focusManager.recheckLiveAnswers();
  _pointerRouter.beginFrame();
  _focusManager.beginFrame();
  try {
    _owner.renderFrame(_root!, buffer);
  } catch (_) {
    _closeFrame(completed: false);
    rethrow;
  }
  _pointerRouter.endFrame();
  _focusManager.endFrame();
  _closeFrame();
  return buffer;
}