call method
Implementation
@override
Stream<TState> call(
  Context<TState> context,
  Event event,
  NextMiddleware<TState> next,
) async* {
  if (event is Undo<TState>) {
    history.removeLast();
    yield history.last;
  } else {
    await for (final state in next(context, event)) {
      history.add(state);
      yield state;
    }
  }
}