context_watch_mobx 3.0.2 copy "context_watch_mobx: ^3.0.2" to clipboard
context_watch_mobx: ^3.0.2 copied to clipboard

context_watch adapter for mobx package

See https://pub.dev/packages/context_watch

Usage #

Add MobxContextWatcher.instance to additionalWatchers of ContextPlus.root:

ContextPlus.root(
  additionalWatchers: [
    MobxContextWatcher.instance,
  ],
  child: ...,
);
copied to clipboard

Observe MobX Observable with Observable.watch(context) or Observable.watchOnly(context, () => ...), without wrapping anything with Observer or subclassing the ObserverStatelessWidget:

final _counter = Observable(0);

class Example extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final counter = _counter.watch(context);
    return Text('Counter: $counter');
  }
}
copied to clipboard
1
likes
150
points
55
downloads

Publisher

verified publishersonerik.dev

Weekly Downloads

2024.08.04 - 2025.02.16

context_watch adapter for mobx package

Repository (GitHub)

Topics

#context-watch #mobx #integration #reactive #state-management

Documentation

API reference

License

MIT (license)

Dependencies

context_watch_base, flutter, mobx

More

Packages that depend on context_watch_mobx