input<TInput extends Object> method

TState input<TInput extends Object>(
  1. TInput input
)

Adds an input value to the logic block's internal input queue.

If the logic block is already processing, the input is enqueued and will be handled after the current input finishes. Returns the current state.

Throws a StateError if the logic block has not been started or has been disposed.

Implementation

TState input<TInput extends Object>(TInput input) {
  _throwIfDisposed('input');

  if (!isStarted) {
    throw StateError(
      'Cannot add input to a logic block that has not been started. '
      'Call start() first.',
    );
  }

  if (isProcessing) {
    _inputs.enqueue(input);
    return _value!;
  }

  return _processInputs<TInput>(input);
}