TypedEpic<State, Action> class

An wrapper that allows you to create Epics which handle actions of a specific type, rather than all actions.

Example

Stream<dynamic> searchEpic(
  // Note: this epic only works with PerformSearchActions
  Stream<PerformSearchAction> actions,
  EpicStore<State> store,
) {
  return actions
    .asyncMap((action) =>
      api.search(action.searchTerm)
        .then((results) => new SearchResultsAction(results))
        .catchError((error) => new SearchErrorAction(error)));
}

final epic = new TypedEpic<State, PerformSearchAction>(typedSearchEpic);

Combining Typed Epics

final epic = combineEpics([
  new TypedEpic<State, SearchAction>(searchEpic),
  new TypedEpic<State, ProfileAction>(profileEpic),
  new TypedEpic<State, ChatAction>(chatEpic),
]);
Inheritance

Constructors

TypedEpic(Stream epic(Stream<Action> actions, EpicStore<State> store))

Properties

epic Stream Function(Stream<Action> actions, EpicStore<State> store)
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(Stream actions, EpicStore<State> store) Stream
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited