BaseEffect class
Every effect class must derived from BaseEffect
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 BaseEffect {
Observable<Action> effectForAsyncInc(Actions action$, Store store$) {
return action$
.ofType(ActionTypes.AsyncInc)
.debounceTime(Duration(milliseconds: 550))
.mapTo(Action(type: ActionTypes.Inc));
}
List<Observable<Action>> registerEffects(Actions action$, Store store$) {
return [effectForAsyncInc(action$, store$)];
}
}
Constructors
- BaseEffect({String effectKey })
- takes String effectKey param
Properties
- effectKey → String
-
final
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
registerEffects(
Actions action$, Store store$) → List< Observable< 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. [...]
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited