void flushLayout()

Update the layout information for all dirty render objects.

This function is one of the core stages of the rendering pipeline. Layout information is cleaned prior to painting so that render objects will appear on screen in their up-to-date locations.

See RendererBinding for an example of how this function is used.

Source

void flushLayout() {
  Timeline.startSync('Layout');
  _debugDoingLayout = true;
  try {
    // TODO(ianh): assert that we're not allowing previously dirty nodes to redirty themeselves
    while (_nodesNeedingLayout.isNotEmpty) {
      List<RenderObject> dirtyNodes = _nodesNeedingLayout;
      _nodesNeedingLayout = <RenderObject>[];
      for (RenderObject node in dirtyNodes..sort((RenderObject a, RenderObject b) => a.depth - b.depth)) {
        if (node._needsLayout && node.owner == this)
          node._layoutWithoutResize();
      }
    }
  } finally {
    _debugDoingLayout = false;
    Timeline.finishSync();
  }
}