public class StatelessElement extends ComponentElement
The Element corresponding to a StatelessWidget.
Since:
6.2.0
Version:
1.0.0
Author:
UltiTools Team
  • Constructor Details

    • StatelessElement

      public StatelessElement(@NotNull @NotNull StatelessWidget widget)
  • Method Details

    • mount

      public void mount(@Nullable @Nullable Element parent)
      Description copied from class: Element
      Mounts this Element into the tree.

      Called the first time the Element is inserted into the tree. Subclasses should perform initialization work here and mount their child Elements.

      CR-01 (T-05-62 / #371): every mount(Element) override in this codebase calls super.mount(parent) before doing its own work (mounting children, running the first performRebuild(), etc.) -- this base method is therefore the single choke point through which the ENTIRE mounting recursion passes, one call per Element, regardless of subtype: ContainerElement/GridViewElement.mountChildren() calling childElement.mount(this) for each child, and the mount()->performRebuild()->updateChild()->mount() cascade StatelessElement/StatefulElement drive when composing a child Widget for the first time. Checking the depth HERE, rather than separately in every subclass's own mounting method, guards the mount recursion exactly once per node without needing to duplicate the check at each override. update()/unmount()'s own recursions need no separate guard: they only ever walk a subtree whose depth was already validated here when it was first mounted, so they can never exceed RenderDepthGuard.MAX_DEPTH without first passing through an unguarded mount() call -- which this check closes.

      Overrides:
      mount in class ComponentElement
      Parameters:
      parent - the parent Element, or null if this is the root Element
    • build

      public Widget build()
      Description copied from class: ComponentElement
      Builds the child Widget.
      Specified by:
      build in class ComponentElement
      Returns:
      the child Widget