Skip to content
Branch: master
Find file History
Type Name Latest commit message Commit time
Failed to load latest commit information.
example Circle CI (#112) Feb 15, 2019
lib Auto publish (#406) Jan 23, 2020
test Remove const instance for better coverage (#375) Jan 4, 2020
.metadata Auto publish (#406) Jan 23, 2020
LICENSE flutter_mobx project Jan 13, 2019 changing badges Jan 21, 2020
flutter_mobx.iml workspace updates Oct 26, 2019


pub package Build Status Coverage Status

Flutter integration with MobX.dart.

Provides the Observer widget that listens to observables and automatically rebuilds on changes.


class CounterExample extends StatefulWidget {
  const CounterExample({Key key}) : super(key: key);

  _CounterExampleState createState() => _CounterExampleState();

class _CounterExampleState extends State<CounterExample> {
  final _counter = Counter();

  Widget build(BuildContext context) => Scaffold(
        appBar: AppBar(
          title: const Text('Counter'),
        body: Center(
          child: Column(
            children: <Widget>[
              const Text(
                'You have pushed the button this many times:',
                  builder: (_) => Text(
                        style: const TextStyle(fontSize: 20),
        floatingActionButton: FloatingActionButton(
          onPressed: _counter.increment,
          tooltip: 'Increment',
          child: const Icon(Icons.add),

Notice the use of the Observer widget that listens to _counter.value, an observable, and rebuilds on changes.

You can go here for more examples


Observer(Widget Function(BuildContext context) builder)

The builder function will be monitored by MobX and tracks all the observables that are being used inside it. When any of the observables change, builder will be called again to rebuild the Widget. This gives you a seamless way to create a reactive Widget.

Note that the Observer will print a warning if no observables are discovered in the builder function.

You can’t perform that action at this time.