rxstore 0.2.1 copy "rxstore: ^0.2.1" to clipboard
rxstore: ^0.2.1 copied to clipboard

outdated

Stream-based Redux implementation with support for side-effects.

example/example.dart

import 'package:rxstore/rxstore.dart';

void main() {
  // Define a simple reducer to multiply the state
  int reducer(int state, Action action) {
    if (action is MultiplyInt) {
      return state * action.number;
    }
    return state;
  }

  // Create a store holding an int with an initial state of 42
  final store = Store<int>(reducer, initialState: 42);

  // Subscribe to state changes by printing them
  store.state.listen(print); // prints 42 (initial state), then 84

  // Dispatch an action
  store.dispatch(const MultiplyInt(2));
}

class MultiplyInt implements Action {
  const MultiplyInt(this.number);

  final int number;
}
2
likes
0
points
57
downloads

Publisher

unverified uploader

Weekly Downloads

Stream-based Redux implementation with support for side-effects.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

rxdart

More

Packages that depend on rxstore