built_redux_repatch 0.3.2

Dart native js
Flutter Android iOS web

repatch for built_redux

Repatch #

By adding a single repatch action dispatcher, one can dispatch builder functions as an action payload. This means one does not have to create an action dispatcher for every reducer, they can dispatch reducers directly.

Example #

Add an action dispatcher:

abstract class CounterActions extends ReduxActions {
  ActionDispatcher<Repatch<Counter, CounterBuilder>> repatchDispatcher;

  // factory to create on instance of the generated implementation of CounterActions
  factory CounterActions() => new _$CounterActions();

Pass repatchReducer to you store as the reducer

var store = new Store<Counter, CounterBuilder, CounterActions>(
  createRepatchReducer<Counter, CounterBuilder>(),
  new Counter(),
  new CounterActions(),

Dispatch the repatch

// increments count
store.actions.repatchDispatcher((s, b) => b.count++);
// decrements count
store.actions.repatchDispatcher((s, b) => b.count--);