addEffect method

dynamic addEffect (EffectCallback callback, { String effectKey })

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

Example

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

Implementation

addEffect(EffectCallback callback, {String effectKey}) {
  removeEffectsByKey(effectKey);
  _subs[effectKey] = callback(_actions, this).listen(dispatch);
}