flutterdux 0.0.1 copy "flutterdux: ^0.0.1" to clipboard
flutterdux: ^0.0.1 copied to clipboard

Dart 1 only

Flutter + Redux.js

FlutterDux #

Flutter + Redux.js

Android only at the moment, iOS coming soon.

Getting Started #

Check out this article for a description of how it works.

Loading website #

void main() {
  runApp(new MyApp());
  FlutterDux.instance.loadUrl('<YOUR WEBSITE RUNNING REDUX>');
}

Binding widgets #

class _MyWidgetState extends State<MyWidget> with FlutterDuxMixin{
  int _counter = 0;

  @override
  List<Property> get properties => [
    new Property(
      statePath: 'counter',
      onChanged: (v) => _counter = v
    )
  ];

  /// The widget's `setState` will be called automatically
  /// when state slice `counter` changes.
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: new Text('$_counter'),
      floatingActionButton: new FloatingActionButton(
        onPressed: () => dispatch({'type': 'INCREMENT'}),
        child: new Icon(Icons.add),
      ),
    );
  }
}

Dispatching actions #

/// Raw action
dispatch({'type': 'INCREMENT'});

/// Action creator
dispatch('incrementCounter');

/// Action creator with arguments
dispatch('addTodo', ['Take out the trash']);
0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

Flutter + Redux.js

Homepage

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on flutterdux