SurveyStep<T>.yesNo constructor

SurveyStep<T>.yesNo({
  1. required String id,
  2. required String title,
  3. String? description,
  4. List<SurveyOption>? options,
  5. T? answer,
  6. bool isRequired = true,
  7. Future<void> beforeComplete(
    1. dynamic answer
    )?,
  8. void onCompleted(
    1. dynamic answer
    )?,
  9. Future<void> onInit(
    1. SurveyStep<T>? step
    )?,
  10. Widget customWidget(
    1. BuildContext context,
    2. SurveyStep<T> step
    )?,
})

Constructor for creating a yes/no survey step.

Parameters:

  • id: The unique identifier for the step.
  • title: The display title for the step.
  • description: An optional description for the step.
  • options: A list of SurveyOption objects representing the choices.
  • isRequired: A boolean indicating if the step is required.

Implementation

SurveyStep.yesNo({
  required this.id,
  required this.title,
  this.description,
  List<SurveyOption>? options,
  this.answer,
  this.isRequired = true,
  this.beforeComplete,
  this.onCompleted,
  this.onInit,
  this.customWidget,
})  : options = options ??
          [
            SurveyOption(id: 'yes', title: 'Yes'),
            SurveyOption(id: 'no', title: 'No')
          ],
      stepType = SurveyStepType.yesNo,
      assert(options == null || options.length == 2,
          'Yes/No questions must have exactly two options.');