Question<V>.fromJson constructor
Question<V>.fromJson(
- Map<String, dynamic> data
)
Implementation
factory 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,
),
DateQuestion.questionType => DateQuestion.fromJson(data),
FreeTextQuestion.questionType => FreeTextQuestion.fromJson(data),
FitbitQuestion.questionType => FitbitQuestion.fromJson(data),
PainQuestion.questionType => PainQuestion.fromJson(data),
_ => throw UnknownJsonTypeError(data[keyType]),
} as Question<V>;