getQuizOptionValue method

String getQuizOptionValue(
  1. QuizQuestionModel question,
  2. dynamic value
)

Implementation

String getQuizOptionValue(QuizQuestionModel question, dynamic value) {
  if(value == QuizConstants.OTHER_OPTION_KEY) {
    return question.other?.getValue() ?? "Autre";
  }

  for (QuizOptionModel item in question.options ?? []) {
    if (item.key == value) {
      return item.label;
    }
  }
  return value.toString();
}