updateAnswer method

Future<void> updateAnswer(
  1. String stepId,
  2. dynamic answer
)

Updates the answer for a specific survey step.

Parameters:

  • stepId: The ID of the step to update.
  • answer: The new answer to set for the step.

Implementation

Future<void> updateAnswer(String stepId, dynamic answer) async {
  final step = steps.firstWhere((step) => step.id == stepId);
  step.answer = answer;
  notifyListeners();
  if (configuration.autoPassToNextStep && !isLastStep) {
    await Future.delayed(configuration.autoPassToNextStepDelay);
    nextStep();
  }
}