call method
A Middleware
function that intercepts a dispatched action
Implementation
@override
void call(Store<State> store, dynamic action, NextDispatcher next) {
if (!_isSubscribed) {
_epics.stream
.switchMap<dynamic>((epic) => epic(_actions.stream, EpicStore(store)))
.listen(store.dispatch);
_epics.add(_epic);
_isSubscribed = true;
}
next(action);
if (supportAsyncGenerators) {
// Future.delayed is an ugly hack to support async* functions.
//
// See: https://github.com/dart-lang/sdk/issues/33818
Future.delayed(Duration.zero, () {
_actions.add(action);
});
} else {
_actions.add(action);
}
}