processStepDone method

Future<void> processStepDone(
  1. S step
)

Implementation

Future<void> processStepDone(S step) async {
  __.in_('processStepDone');
  try {
    // Get next step - this will return BaseFlowStep.end for the last step
    trackStepEnd(flowType.name, step.name);
    final Enum? nextStep = getNextStep(step);
    if (nextStep != null) {
      await navigateToStep(nextStep);
    } else {
      // No next step defined and not the last step
      // This is an unexpected condition but we'll handle it gracefully
      __.warning(
        'No next step defined for ${step.name} and not the last step',
      );
      throw hujFlowException(
        message:
            'No next step defined for ${step.name} and not the last step',
        hujType: hujErrorType.flow,
        originalError: Exception(),
      );
    }
  } finally {
    __.out_('processStepDone');
  }
}