WidgetHost class Widgets

Mounts the live widget subtrees behind a Scene's WidgetComponents for a scene that is rendered without a SceneView.

A WidgetComponent's texture only updates while its subtree is mounted somewhere in the app's widget tree. SceneView mounts them itself, so a scene drawn by a SceneView needs no WidgetHost, and mounting both for the same scene would run every subtree twice. Use this for a scene drawn through Scene.renderViews or a render-to-target path by code that owns its own frame loop (an XR session, a headless capture). Place it anywhere in the tree, typically as a sibling of the app's UI inside a Stack.

The host takes no layout space and paints nothing; each hosted subtree stays live (state, tickers, animations) and streams into its component's texture. Pointer input reaches the subtrees through a ScenePointer or the component's controller, since WidgetInput.automatic forwarding is part of SceneView.

Stack(
  children: [
    MyXrHud(),
    WidgetHost(scene: scene),
  ],
)
Inheritance

Constructors

WidgetHost({Key? key, required Scene scene})
Creates a host for scene's widget components.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scene → Scene
The scene whose WidgetComponent subtrees this hosts.
final

Methods

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited