disposableElement method

void disposableElement(
  1. Widget widget,
  2. void callback(
    1. RenderBox
    )
)

It creates an disposable off-list element built with the specified widget, and executes the callback. Eventually, the child is disposed.

Implementation

void disposableElement(Widget widget, void Function(RenderBox) callback) {
  owner!.lockState(() {
    _currentlyUpdatingChildIndex = null;
    _currentlyUpdatingPopUpList = null;
    _creatingDisposableElement = true;
    var _measuringOffListChild = updateChild(null, widget, null);
    assert(_measuringOffListChild != null);
    callback.call(_measuringOffListChild!.renderObject! as RenderBox);
    _measuringOffListChild = updateChild(_measuringOffListChild, null, null);
    _creatingDisposableElement = false;
    assert(_measuringOffListChild == null);
  });
}