inflateWidget method

  1. @override
Element inflateWidget(
  1. Widget newWidget,
  2. Object? newSlot
)
override

Create an element for the given widget and add it as a child of this element in the given slot.

This method is typically called by updateChild but can be called directly by subclasses that need finer-grained control over creating elements.

If the given widget has a global key and an element already exists that has a widget with that global key, this function will reuse that element (potentially grafting it from another location in the tree or reactivating it from the list of inactive elements) rather than creating a new element.

The newSlot argument specifies the new value for this element's slot.

The element returned by this function will already have been mounted and will be in the "active" lifecycle state.

Implementation

@override
Element inflateWidget(Widget newWidget, Object? newSlot) {
  final Element newChild = super.inflateWidget(newWidget, newSlot);
  assert(_debugCheckHasAssociatedRenderObject(newChild));
  return newChild;
}