markNeedsBuild method Null safety

void markNeedsBuild()

Marks this layout builder as needing to rebuild.

The layout build rebuilds automatically when layout constraints 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:

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();
}