beginFrame method

void beginFrame(
  1. Element root
)

Starts a frame by resetting accumulators and running the build phase.

Implementation

void beginFrame(Element root) {
  // Reset per-frame phase accumulators.
  _currentBuildDuration = Duration.zero;
  _currentLayoutDuration = Duration.zero;
  _currentPaintDuration = Duration.zero;
  // Preserve any `true` value set by didRebuild() during the dispatch
  // phase that precedes this render pass.  Without `||`, elements rebuilt
  // during dispatch (e.g., a HoverTracker setState) would be invisible to
  // viewport paint-cache invalidation because their dirty flags were
  // already cleared before beginFrame runs.
  _hadBuildThisFrame = _hadBuildThisFrame || _dirty.isNotEmpty;
  buildScope(root);
}