flutter_mobx_helpers 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 86

flutter_mobx_helpers #

A set of tools for MobX.

Install #

edit your pubspec.yaml file

dependencies:
    flutter_mobx_helpers:

Tools #

ObservableListener #

Use this widget to have a response that can perform actions on the business rule such as opening another screen or calling a SnackBar/Dialog.

ObserverListener(
    listener: (_) {
        var snack = SnackBar(content: Text('Click ${store.value}'));
        _scaffold.currentState.showSnackBar(snack);
    },
    child: RaisedButton(
        child: Text('Call Snackbar'),
        onPressed: store.setValue,
    ),
)

Contributions #

Do you have any idea of ​​a widget or utility to add to this help? Submit a pull request to this package's repository. We look forward to it!

[1.0.1] - 02/02/2020 #

  • New version of mobx.

[1.0.0] - 26/01/2020 #

  • Release.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_mobx_helpers/flutter_mobx_helpers.dart';

import 'mystore.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  GlobalKey<ScaffoldState> _scaffold = GlobalKey<ScaffoldState>();
  MyStore store = MyStore();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      key: _scaffold,
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
          child: ObserverListener(
        listener: (_) {
          var snack = SnackBar(content: Text('Click ${store.value}'));
          _scaffold.currentState.showSnackBar(snack);
        },
        child: RaisedButton(
          child: Text('Call Snackbar'),
          onPressed: store.setValue,
        ),
      )),
      floatingActionButton: FloatingActionButton(
        onPressed: store.setValue,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_mobx_helpers: ^1.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub 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_helpers/flutter_mobx_helpers.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
71
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
86
Learn more about scoring.

We analyzed this package on Jul 14, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • flutter_mobx_helpers that is a package requiring null.

Health suggestions

Fix lib/src/observer_listener.dart. (-0.50 points)

Analysis of lib/src/observer_listener.dart reported 1 hint:

line 3 col 8: Don't import implementation files from another package.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
mobx >=1.0.0 <2.0.0 1.2.1+1
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test