Component class abstract

A unit of data or behavior attached to a Node.

A node owns an ordered list of components. Components are added with Node.addComponent and removed with Node.removeComponent, and they run logic through a set of overridable lifecycle hooks.

Subclasses override the onX hooks and update; all other members are driven by the engine and should not be called directly.

Implementers

Constructors

Component()

Properties

enabled bool
Whether this component's update hook runs each frame.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isAttached bool
Whether this component is currently attached to a node.
no setter
isLoaded bool
Whether onLoad has completed.
no setter
isMounted bool
Whether the owning node is part of a live scene graph.
no setter
node Node
The node this component is attached to.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onAttach() → void
Called when this component is added to a node.
onDetach() → void
Called when this component is removed from a node.
onLoad() Future<void>
Optional asynchronous setup, such as loading an asset.
onMount() → void
Called when the owning node enters a live scene graph.
onUnmount() → void
Called when the owning node leaves a live scene graph.
toString() String
A string representation of this object.
inherited
update(double deltaSeconds) → void
Called once per frame while the component is mounted, enabled, and loaded. deltaSeconds is the elapsed time since the previous tick.

Operators

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