Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/plugfox/control
Simple state management for Flutter with concurrency support.
https://github.com/plugfox/control
architecture concurrency controller dart flutter state state-management
Last synced: 2 months ago
JSON representation
Simple state management for Flutter with concurrency support.
- Host: GitHub
- URL: https://github.com/plugfox/control
- Owner: PlugFox
- License: mit
- Created: 2023-12-28T15:45:54.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-10-16T13:58:44.000Z (3 months ago)
- Last Synced: 2024-10-19T04:19:26.435Z (3 months ago)
- Topics: architecture, concurrency, controller, dart, flutter, state, state-management
- Language: Dart
- Homepage:
- Size: 351 KB
- Stars: 18
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Control: State Management for Flutter
[![Pub](https://img.shields.io/pub/v/control.svg)](https://pub.dev/packages/control)
[![Actions Status](https://github.com/PlugFox/control/actions/workflows/checkout.yml/badge.svg)](https://github.com/PlugFox/control/actions)
[![Coverage](https://codecov.io/gh/PlugFox/control/branch/master/graph/badge.svg)](https://codecov.io/gh/PlugFox/control)
[![License: MIT](https://img.shields.io/badge/license-MIT-purple.svg)](https://opensource.org/licenses/MIT)
[![Linter](https://img.shields.io/badge/style-linter-40c4ff.svg)](https://pub.dev/packages/linter)
[![GitHub stars](https://img.shields.io/github/stars/plugfox/control?style=social)](https://github.com/plugfox/control/)---
## Installation
Add the following dependency to your `pubspec.yaml` file:
```yaml
dependencies:
control:
```## Example
```dart
/// Counter state for [CounterController]
typedef CounterState = ({int count, bool idle});/// Counter controller
final class CounterController extends StateController
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.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.delayed(const Duration(milliseconds: 1500));
setState((idle: true, count: state.count - value));
});
}
```## Coverage
[![](https://codecov.io/gh/PlugFox/control/branch/master/graphs/sunburst.svg)](https://codecov.io/gh/PlugFox/control/branch/master)
## Changelog
Refer to the [Changelog](https://github.com/PlugFox/control/blob/master/CHANGELOG.md) to get all release notes.
## Maintainers
- [Matiunin Mikhail aka Plague Fox](https://plugfox.dev)
## Funding
If you want to support the development of our library, there are several ways you can do it:
- [Buy me a coffee](https://www.buymeacoffee.com/plugfox)
- [Support on Patreon](https://www.patreon.com/plugfox)
- [Subscribe through Boosty](https://boosty.to/plugfox)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](https://opensource.org/licenses/MIT)