registerEffect method

void registerEffect (
  1. EffectCallback callback,
  2. {@required String effectKey}
)

This method is usefull to add a single effect passing a callback ( Actions action$, Store store$)=>Stream and effectKey on demand.

Example

registerEffect((action$, store$)=>action$
          .whereType(ActionTypes.AsyncInc)
          .debounceTime(Duration(milliseconds: 1000))
          .mapTo(Action(type: ActionTypes.Inc)), effectKey:'any-effectKey');

Implementation

void registerEffect(EffectCallback callback, {@required String effectKey}) {
  unregisterEffect(effectKey: effectKey);
  _effectSubscriptions[effectKey] = callback(_actions, this).listen(dispatch);
  dispatch(Action(type: 'registerEffect($effectKey)'));
}