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

outdated

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<CounterModule> {
  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
0
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

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_super_state