PropsReadonlyNode<T extends Widget> class

A reactive node that tracks widget property changes.

This node allows reactive code (like useComputed or useEffect) to depend on widget properties. When the widget is updated with new properties, this node notifies all its subscribers to re-run.

Usage

The node's value returns the current widget instance, providing reactive access to all widget properties.

With SetupWidget

class UserCard extends SetupWidget<UserCard> {
  final String name;
  final int age;

  const UserCard({super.key, required this.name, required this.age});

  @override
  setup(context, props) {
    // Access props reactively - rebuilds when name changes
    final displayName = useComputed(() => 'User: ${props().name}');

    return () => Text(displayName.value);
  }
}

With SetupMixin

class _MyWidgetState extends State<MyWidget> with SetupMixin<MyWidget> {
  @override
  setup(context) {
    // Access props via mixin's getter
    final displayName = useComputed(() => 'User: ${props.name}');

    return () => Text(displayName.value);
  }
}

Implementation Notes

  • Implements ReadonlyNode for compatibility with Jolt's reactive system
  • Tracks dependencies automatically when accessed in reactive contexts
  • Disposed when the associated BuildContext is unmounted
Inheritance
Implemented types

Constructors

PropsReadonlyNode(BuildContext _context)

Properties

deps Link?
First dependency link in the chain.
getter/setter pairinherited
depsTail Link?
Last dependency link in the chain.
getter/setter pairinherited
flags int
Reactive flags for this node.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
isDisposed bool
Whether this node has been disposed.
no setteroverride
peek → T
Gets the current value without establishing a reactive dependency.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subs Link?
First subscriber link in the chain.
getter/setter pairinherited
subsTail Link?
Last subscriber link in the chain.
getter/setter pairinherited
value → T
Gets the current value and establishes a reactive dependency.
no setteroverride

Methods

call() → T
dispose() FutureOr<void>
Dispose this object and clean up its resources.
get() → T
Gets the current value and establishes a reactive dependency.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notify() → void
Manually notifies all subscribers that this value has changed.
override
onDispose() → void
Called when the node is being disposed.
override
toString() String
A string representation of this object.
inherited
updateNode() bool
Updates the node and reports whether its value changed.
override

Operators

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