0 purchases
context watch signals
See https://pub.dev/packages/context_watch
Usage #
Remove signals_flutter from your pubspec.yaml. context_watch_signals re-exports everything from signals_flutter except the original watch() and unwatch() extensions, so that you don't have name resolution conflicts.
Add SignalContextWatcher.instance to additionalWatchers of ContextPlus.root:
ContextPlus.root(
additionalWatchers: [
SignalContextWatcher.instance,
],
child: ...,
);
copied to clipboard
Observe Signals with Signal.watch(context) or Signal.watchOnly(context, () => ...):
final _counter = signal(0);
class Example extends StatelessWidget {
@override
Widget build(BuildContext context) {
final counter = _counter.watch(context);
final counterSquared = _counter.watchOnly(context, (counter) => counter * counter);
return Text('Counter: $counter, CounterĀ²: $counterSquared');
}
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.