EffectBase class
Every effect class must derived from EffectBase
class. And it is optional to pass the
effectKey
. But it's mandatory if you want conditionally remove the effects by using
store.removeEffectsByKey('effectKey')
Example
class CounterEffect extends EffectBase {
Stream<Action> effectForAsyncInc(Actions action$, Store store$) {
return action$
.ofType(ActionTypes.AsyncInc)
.debounceTime(Duration(milliseconds: 550))
.mapTo(Action(type: ActionTypes.Inc));
}
List<Stream<Action>> registerEffects(Actions action$, Store store$) {
return [effectForAsyncInc(action$, store$)];
}
}
Constructors
-
EffectBase({String effectKey}
) - takes String effectKey param
Properties
Methods
-
noSuchMethod(
Invocation invocation ) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
registerEffects(
Actions action$, Store store$ ) → List< Stream< Action> > - This function should be invoked by system passing reference of Actions and Store classes. Please keep in mind that effects should not work until you register them. Here is the example how to register effectForAsyncInc effect. [...]
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
Object other ) → bool -
The equality operator. [...]
inherited