redurx 0.1.0+1 redurx: ^0.1.0+1 copied to clipboard
A thin layer of a Redux-based state manager on top of RxDart.
ReduRx #
👌 A thin layer of a Redux-based state manager on top of RxDart.
Usage #
import 'package:redurx/redurx.dart';
class State {
State(this.count);
final int count;
}
class Increment extends Action<State> {
Increment([this.by = 1]);
final int by;
State reduce(State state) => State(state.count + by);
}
void main() {
final store = Store<State>(State(0));
print(store.state); // Instance of 'State'
print(store.state.count); // 0
store.dispatch(Increment());
print(store.state.count); // 1
store.dispatch(Increment(2));
print(store.state.count); // 3
}