context_watch_signals

Creator: coderz1093

Last updated:

0 purchases

context_watch_signals Image
context_watch_signals Images

Languages

Categories

Add to Cart

Description:

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

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.