reduct 1.0.1 copy "reduct: ^1.0.1" to clipboard
reduct: ^1.0.1 copied to clipboard

An elementary yet adaptable state management solution for Dart.

example/reduct_example.dart

import 'package:reduct/reduct.dart';

void main() {
  // initialize the reducer
  CounterReducer();

  // call increment twice
  incrementAction();
  incrementAction();

  // outputs:
  // My counter: 1
  // My counter: 2
}

// atoms
final counterState = Atom(0);
final incrementAction = Atom.action();

// reducer
class CounterReducer extends Reducer {
  CounterReducer() {
    on(incrementAction, (_) => counterState.value++);
    on(counterState, (value) => print('My counter: $value'));
  }
}
1
likes
160
points
46
downloads

Publisher

verified publishereronsoft.com

Weekly Downloads

An elementary yet adaptable state management solution for Dart.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

More

Packages that depend on reduct