callBuilders method Null safety

Widget callBuilders(
  1. BuildContext context,
  2. Widget? child
)

Calls builder callbacks on the specified child widget.

Implementation

Widget callBuilders(BuildContext context, Widget? child) {
  var built = unwrap(context, child ?? widget0);
  if (child != null && built == widget0) {
    // child has been unwrapped into no op, stop processing further right now
    return widget0;
  }

  for (final builder in _builders) {
    built = unwrap(context, builder(context, built) ?? widget0);
    if (built == widget0) {
      // builder returns no op, cancel subsequent callbacks
      return widget0;
    }
  }

  built.setAnchorsIfUnset(anchors);

  return built;
}