SignalWidget class abstract
A reactive StatelessWidget that implicitly tracks and rebuilds on signal changes.
SignalWidget establishes a dynamic reactive context directly at the Flutter element layer.
Any signal accessed via .value inside the build method is implicitly tracked and
subscribed to. When any of these signals mutate, only this widget is rebuilt.
This offers a clean, Javascript-style reactivity experience without needing manual
builder widgets (like SignalBuilder) or deprecated context watch extensions.
Implicit Reactivity Example (Stateless)
final username = signal('Rody');
final status = signal('Online');
class UserProfileView extends SignalWidget {
const UserProfileView({super.key});
@override
Widget build(BuildContext context) {
// 'username' and 'status' are implicitly tracked on access:
return Column(
children: [
Text('Name: ${username.value}'),
Text('Status: ${status.value}'),
],
);
}
}
Important
Only signals accessed synchronously during the execution of the build method are tracked.
Signals read inside async callbacks, listeners, or deferred tasks are not subscribed to.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- SignalWidget
- Available extensions
Constructors
- SignalWidget({Key? key})
-
Constructor for SignalWidget.
const
Properties
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
inherited
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
override
-
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
-
toSignalWidget(
) → SignalWidget -
Available on StatelessWidget, provided by the StatelessWidgetConvertWidgetExtension extension
Converts this StatelessWidget to a SignalWidget. -
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