flutter_mobx 0.1.1

  • README.md
  • Example
  • Installing
  • Versions
  • 93

flutter_mobx #

pub package CircleCI

Flutter integration with MobX.dart.

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

Example #

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(
            mainAxisAlignment: MainAxisAlignment.center,
            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 #

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 also throw an AssertionError if no observables are discovered in the builder function.

[0.0.1] - First release.

  • Observer component that re-renders when reactive variables change.


Examples #

Counter #

The default example that you get when you create a new Flutter app. Now flavored with MobX :-).

Jump to Source

Todos #

Can't miss out on the Todos! It's a classic way of showcasing a framework.

Jump to Source

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_mobx: ^0.1.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_mobx/flutter_mobx.dart';
Version Uploaded Documentation Archive
0.1.1 Mar 3, 2019 Go to the documentation of flutter_mobx 0.1.1 Download flutter_mobx 0.1.1 archive
0.1.0+1 Feb 27, 2019 Go to the documentation of flutter_mobx 0.1.0+1 Download flutter_mobx 0.1.0+1 archive
0.1.0 Feb 27, 2019 Go to the documentation of flutter_mobx 0.1.0 Download flutter_mobx 0.1.0 archive
0.0.14 Feb 17, 2019 Go to the documentation of flutter_mobx 0.0.14 Download flutter_mobx 0.0.14 archive
0.0.13 Feb 12, 2019 Go to the documentation of flutter_mobx 0.0.13 Download flutter_mobx 0.0.13 archive
0.0.12 Feb 12, 2019 Go to the documentation of flutter_mobx 0.0.12 Download flutter_mobx 0.0.12 archive
0.0.11 Feb 12, 2019 Go to the documentation of flutter_mobx 0.0.11 Download flutter_mobx 0.0.11 archive
0.0.10 Feb 10, 2019 Go to the documentation of flutter_mobx 0.0.10 Download flutter_mobx 0.0.10 archive
0.0.9 Feb 7, 2019 Go to the documentation of flutter_mobx 0.0.9 Download flutter_mobx 0.0.9 archive
0.0.8 Jan 29, 2019 Go to the documentation of flutter_mobx 0.0.8 Download flutter_mobx 0.0.8 archive

All 17 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Mar 6, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.3.3


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0-dev <3.0.0
flutter 0.0.0
mobx ^0.1.0 0.1.1
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
mockito ^4.0.0