run method

  1. @override
Future<void> run(
  1. EffectHandler<Value> handler
)
override

Executes the effect immediately with the supplied handler. Each effect implementation defines how it schedules work, emits values, and registers disposables.

Implementation

@override
Future<void> run(
  EffectHandler<Value> handler,
) {
  if (!handler.guard()) return Future.value();
  return effect.run(
    (
      emit: handler.emit,
      dispose: ({id, shouldCancel = true}) => handler.dispose(id: this.id, shouldCancel: shouldCancel),
      register: (cancellable, {cancelInFlight = false, id}) => handler.register(
            cancellable,
            id: this.id,
            cancelInFlight: this.cancelInFlight,
          ),
      guard: handler.guard,
    ),
  );
}