context_watch_getx 3.0.1 context_watch_getx: ^3.0.1 copied to clipboard
context_watch adapter for 'get' package
See https://pub.dev/packages/context_watch
Usage #
Add GetxContextWatcher.instance
to additionalWatchers
of ContextPlus.root
:
ContextPlus.root(
additionalWatchers: [
GetxContextWatcher.instance,
],
child: ...,
);
Observe GetX's Rx
values with Rx.watch(context)
or Rx.watchOnly(context, () => ...)
, without wrapping anything with Obx
:
final _counter = Rx(0);
class Example extends StatelessWidget {
@override
Widget build(BuildContext context) {
final counter = _counter.watch(context);
return Text('Counter: $counter');
}
}