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

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

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