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

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
120
pub points
24%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

rxdart

More

Packages that depend on rxstore