scheduleLayoutCallback method

  1. @mustCallSuper
void scheduleLayoutCallback()

Informs the framework that the layout callback has been updated and must be invoked again when this RenderObject is ready for layout, even when an ancestor RenderObject chooses to skip laying out this render subtree.

Implementation

@mustCallSuper
void scheduleLayoutCallback() {
  if (_needsRebuild) {
    assert(debugNeedsLayout);
    return;
  }
  _needsRebuild = true;
  // This ensures that the layout callback will be run even if an ancestor
  // chooses to not lay out this subtree (for example, obstructed OverlayEntries
  // with `maintainState` set to true), to maintain the widget tree integrity
  // (making sure global keys are unique, for example).
  owner?._nodesNeedingLayout.add(this);
  // In an active tree, markNeedsLayout is needed to inform the layout boundary
  // that its child size may change.
  super.markNeedsLayout();
}