call method

  1. @override
Stream<TState> call(
  1. Context<TState> context,
  2. Event event,
  3. NextMiddleware<TState> next
)
override

Implementation

@override
Stream<TState> call(
  Context<TState> context,
  Event event,
  NextMiddleware<TState> next,
) async* {
  final logger = this.logger ?? Logger.root;
  final executionId = _uniqueId++;
  final stopwatch = Stopwatch()..start();
  logger.fine('[$event]($executionId) Starting');
  await for (final state in next(context, event)) {
    yield state;
    if (logState) {
      logger.fine('[$event]($executionId) State updated : $state');
    }
  }
  logger.fine('[$event]($executionId) Finished after ${stopwatch.elapsed}');
}