SagaMonitor class
Used by the middleware to dispatch monitoring events. Actually the middleware dispatches 6 events:
-
When a root saga is started (via SagaMiddleware.run) the middleware invokes SagaMonitor.rootSagaStarted
-
When an effect is triggered (via
yield someEffect
) the middleware invokes SagaMonitor.effectTriggered -
If the effect is resolved with success the middleware invokes SagaMonitor.effectResolved
-
If the effect is rejected with an error the middleware invokes SagaMonitor.effectRejected
-
If the effect is cancelled the middleware invokes SagaMonitor.effectCancelled
-
Finally, the middleware invokes SagaMonitor.actionDispatched when a Redux action is dispatched.
Note : All events are attached to an empty function by default.
Example
// create a monitor instance
var monitor = SagaMonitor();
// attach monitor events
// monitor.rootSagaStarted = ...
// pass the monitoring object to the middleware
var sagaMiddleware = createMiddleware(options: Options(sagaMonitor: monitor));
var store = createStore(sagaMiddleware);
sagaMiddleware.setStore(store);
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
actionDispatched(
dynamic action) → void - Defines function type which is invoked when a Redux action is dispatched
-
effectCancelled(
int effectId) → void - Defines function type which is invoked when an effect is cancelled by the middleware
-
effectRejected(
int effectId, dynamic error) → void - Defines function type which is invoked when an effect is rejected by the middleware
-
effectResolved(
int effectId, dynamic result) → void - Defines function type which is invoked when an effect is successfully resolved by the middleware
-
effectTriggered(
int effectId, int parentEffectId, dynamic label, dynamic effect) → void - Defines function type which is invoked when an effect triggered by the middleware
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rootSagaStarted(
int effectId, Function saga, List? args, Map< Symbol, dynamic> ? namedArgs, String? name) → void - Defines function type which is invoked when a root saga is starts
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited