runWorkflow function

Future<Response> runWorkflow(
  1. Step step, [
  2. void onData(
    1. Response
    )?
])

Runs the Step as workflow and creates a FlowContextController for it.

onData calls whenever a Response occurs.

Implementation

Future<Response> runWorkflow(
  Step step, [
  void Function(Response)? onData,
]) async {
  final FlowContextController controller = FlowContextController.observed(
    onData ?? (_) {},
  );
  await step.execute(controller);
  return await controller.close();
}