start method

Future<void> start(
  1. S initialStep
)

Implementation

Future<void> start(S initialStep) async {
  __.in_('start');
  try {
    checkInitialized('BaseFlow');

    // Always call onStart when the flow begins, regardless of initial step
    onStart();

    // Store the starting step enum in flow state for reference
    flowState['startStep'] = initialStep;

    // Navigate to the initial step
    await navigateToStep(initialStep);

    __.info('Started flow: $flowType at step: ${initialStep.toString()}');
  } catch (e, stackTrace) {
    __.severe('Failed to start flow', e, stackTrace);
    throw hujFlowException(
      message: 'Failed to start flow',
      hujType: hujErrorType.flow,
      originalError: e,
    );
  } finally {
    __.out_('start');
  }
}