flutter_super_state 0.2.0 copy "flutter_super_state: ^0.2.0" to clipboard
flutter_super_state: ^0.2.0 copied to clipboard

A simple super state management library for Flutter (with async support).

example/flutter_super_state_example.dart

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

class CounterModule extends StoreModule {
  int get counter => _counter;

  var _counter = 0;

  CounterModule(Store store) : super(store);

  void increment() {
    setState(() {
      _counter++;
    });
  }
}

void main() {
  final store = Store();
  CounterModule(store);

  runApp(StoreProvider(
    store: store,
    child: ExampleApp(),
  ));
}

class ExampleApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: "flutter_super_state example",
      home: Scaffold(
        appBar: AppBar(
          title: Text("flutter_super_state example"),
        ),
        body: ModuleBuilder<CounterModule>(
          builder: (context, counterModule) => Column(
            children: <Widget>[
              Center(
                child: RaisedButton(
                  child: Text("Increment"),
                  onPressed: () => counterModule.increment(),
                ),
              ),
              Center(
                child: Text("Pressed ${counterModule.counter} times"),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
13
likes
40
pub points
0%
popularity

Publisher

verified publishercretezy.com

A simple super state management library for Flutter (with async support).

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_super_state