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

Simple state management for Flutter with concurrency support.

Control: State Management for Flutter #

Pub Actions Status Coverage License: MIT Linter GitHub stars


Installation #

Add the following dependency to your pubspec.yaml file:

dependencies:
  control: <version>

Example #

/// Counter state for [CounterController]
typedef CounterState = ({int count, bool idle});

/// Counter controller
final class CounterController extends StateController<CounterState>
    with SequentialControllerHandler {
  CounterController({CounterState? initialState})
      : super(initialState: initialState ?? (idle: true, count: 0));

  void add(int value) => handle(() async {
        setState((idle: false, count: state.count));
        await Future<void>.delayed(const Duration(milliseconds: 1500));
        setState((idle: true, count: state.count + value));
      });

  void subtract(int value) => handle(() async {
        setState((idle: false, count: state.count));
        await Future<void>.delayed(const Duration(milliseconds: 1500));
        setState((idle: true, count: state.count - value));
      });
}

Coverage #

Changelog #

Refer to the Changelog to get all release notes.

Maintainers #

Funding #

If you want to support the development of our library, there are several ways you can do it:

We appreciate any form of support, whether it's a financial donation or just a star on GitHub. It helps us to continue developing and improving our library. Thank you for your support!

License #

MIT

28
likes
150
pub points
76%
popularity

Publisher

verified publisherplugfox.dev

Simple state management for Flutter with concurrency support.

Repository (GitHub)
View/report issues

Topics

#architecture #state-management #state #concurrency #controller

Documentation

API reference

Funding

Consider supporting this project:

www.buymeacoffee.com
www.patreon.com
boosty.to

License

MIT (license)

Dependencies

flutter, meta

More

Packages that depend on control