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

Runnable<RunInput, RunnableOptions, RunOutput> fromRouter<RunInput extends Object, RunOutput extends Object>(
  1. FutureOr<Runnable<RunInput, RunnableOptions, RunOutput>> router(
    1. RunInput input,
    2. RunnableOptions? options
    )
)

Creates a RunnableRouter from a Dart function.

A RunnableRouter takes the input it receives and routes it to the runnable returned by the router function.

  • router - the function that will be called to determine the runnable to use.

Implementation

static Runnable<RunInput, RunnableOptions, RunOutput>
    fromRouter<RunInput extends Object, RunOutput extends Object>(
  final FutureOr<Runnable<RunInput, RunnableOptions, RunOutput>> Function(
    RunInput input,
    RunnableOptions? options,
  ) router,
) {
  return RunnableRouter<RunInput, RunOutput>(router);
}