flutter_store 1.0.0+3 copy "flutter_store: ^1.0.0+3" to clipboard
flutter_store: ^1.0.0+3 copied to clipboard

outdated

flutter_stores is simple state management for Flutter inspired by Flutter itself. It is clean and simple state management solution without any boilerplate.

example/lib/main.dart

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

class _Counter extends Store {
  int _value = 0;
  get value => _value;

  void increment() => setState(() {
    _value += 1;
  });
}

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

final _counter = _Counter();

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Counter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Provider(
        store: _counter,
        child: MyHomePage(title: 'Counter Demo Home Page')
      ),
    );
  }
}

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

  final String title;

  @override
  Widget build(BuildContext context) {
    final counter = Provider.of<_Counter>(context);

    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '${counter.value}',
              style: Theme.of(context).textTheme.display1,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => counter.increment(),
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}
6
likes
40
pub points
33%
popularity

Publisher

unverified uploader

flutter_stores is simple state management for Flutter inspired by Flutter itself. It is clean and simple state management solution without any boilerplate.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter, meta

More

Packages that depend on flutter_store