Question<V>.fromJson constructor

Question<V>.fromJson(
  1. Map<String, dynamic> data
)

Implementation

factory Question.fromJson(Map<String, dynamic> data) =>
    switch (data[keyType]) {
      BooleanQuestion.questionType => BooleanQuestion.fromJson(data),
      ChoiceQuestion.questionType => ChoiceQuestion.fromJson(data),
      ScaleQuestion.questionType => ScaleQuestion.fromJson(data),
      AnnotatedScaleQuestion.questionType =>
        AnnotatedScaleQuestion.fromJson(data),
      VisualAnalogueQuestion.questionType =>
        VisualAnalogueQuestion.fromJson(data),
      ImageCapturingQuestion.questionType =>
        ImageCapturingQuestion.fromJson(data),
      AudioRecordingQuestion.questionType =>
        AudioRecordingQuestion.fromJson(data),
      FreeTextQuestion.questionType => FreeTextQuestion.fromJson(data),
      _ => throw UnknownJsonTypeError(data[keyType]),
    } as Question<V>;