fromFunction<RunInput extends Object, RunOutput extends Object> static method

Runnable<RunInput, RunnableOptions, RunOutput> fromFunction<RunInput extends Object, RunOutput extends Object>({
  1. FutureOr<RunOutput> invoke(
    1. RunInput input,
    2. RunnableOptions? options
    )?,
  2. Stream<RunOutput> stream(
    1. Stream<RunInput> inputStream,
    2. RunnableOptions? options
    )?,
})

Creates a RunnableFunction from a Dart function.

A RunnableFunction allows you to run a Dart function as part of a chain.

  • function - the function to run.

Implementation

static Runnable<RunInput, RunnableOptions, RunOutput>
    fromFunction<RunInput extends Object, RunOutput extends Object>({
  final FutureOr<RunOutput> Function(
    RunInput input,
    RunnableOptions? options,
  )? invoke,
  final Stream<RunOutput> Function(
    Stream<RunInput> inputStream,
    RunnableOptions? options,
  )? stream,
}) {
  return RunnableFunction<RunInput, RunOutput>(
    invoke: invoke,
    stream: stream,
  );
}