markNeedsBuild method

void markNeedsBuild()
inherited

Marks this layout builder as needing to rebuild.

The layout builder rebuilds automatically when builder data change. However, we must also rebuild when the widget updates, e.g. after State.setState, or State.didChangeDependencies, even when the layout constraints remain unchanged.

See also:

  • BuilderDataLayoutBuilder.builder, which is called during the rebuild.

Implementation

void markNeedsBuild() {
  // Do not call the callback directly. It must be called during the layout
  // phase, when parent constraints are available. Calling `markNeedsLayout`
  // will cause it to be called at the right time.
  _needsBuild = true;
  markNeedsLayout();
}