WidgetToRenderBoxAdapter constructor Null safety

WidgetToRenderBoxAdapter(
  1. {required RenderBox renderBox,
  2. VoidCallback? onBuild,
  3. VoidCallback? onUnmount}
)

Creates an adapter for placing a specific RenderBox in the widget tree.

The renderBox argument must not be null.

Implementation

WidgetToRenderBoxAdapter({
  required this.renderBox,
  this.onBuild,
  this.onUnmount,
}) : assert(renderBox != null),
     // WidgetToRenderBoxAdapter objects are keyed to their render box. This
     // prevents the widget being used in the widget hierarchy in two different
     // places, which would cause the RenderBox to get inserted in multiple
     // places in the RenderObject tree.
     super(key: GlobalObjectKey(renderBox));