An IDE quick-fix refactoring tool (Dart Assist) that automatically converts a standard
StatelessWidget to extend the reactive SignalWidget instead.
By extending
SignalWidget instead of StatelessWidget, your widget automatically registers
fine-grained dependency tracking for any signals referenced within its build method. It
will rebuild automatically when their values change, removing the need for manual listener
code or wrapper components.
How to use#
-
Place your cursor on the widget class declaration (e.g.,
class MyWidget extends StatelessWidget). -
Click the lightbulb icon or press your IDE's quick-fix shortcut (
Alt+EnterorCmd+.). - Select the Convert to SignalWidget assist option.
Examples#
Before:
class CounterDisplay extends StatelessWidget {
const CounterDisplay({super.key});
@override
Widget build(BuildContext context) {
return Text('Count: ${counter.value}');
}
}
After (Apply Assist):
class CounterDisplay extends SignalWidget {
const CounterDisplay({super.key});
@override
Widget build(BuildContext context) {
return Text('Count: ${counter.value}');
}
}