AnswerFormat.fromJson constructor
AnswerFormat.fromJson(
- Map<String, dynamic> json
)
Implementation
factory AnswerFormat.fromJson(Map<String, dynamic> json) {
final type = json['type'] as String?;
assert(type != null, 'type is required');
switch (type) {
case MultipleChoiceAnswerFormat.type:
return MultipleChoiceAnswerFormat.fromJson(json);
case SingleChoiceAnswerFormat.type:
return SingleChoiceAnswerFormat.fromJson(json);
case BooleanAnswerFormat.type:
return BooleanAnswerFormat.fromJson(json);
case DateAnswerFormat.type:
return DateAnswerFormat.fromJson(json);
case DoubleAnswerFormat.type:
return DoubleAnswerFormat.fromJson(json);
case IntegerAnswerFormat.type:
return IntegerAnswerFormat.fromJson(json);
case ImageAnswerFormat.type:
return ImageAnswerFormat.fromJson(json);
case TextAnswerFormat.type:
return TextAnswerFormat.fromJson(json);
case TimeAnswerFormat.type:
return TimeAnswerFormat.fromJson(json);
case ScaleAnswerFormat.type:
return ScaleAnswerFormat.fromJson(json);
case MultipleChoiceAutoCompleteAnswerFormat.type:
return MultipleChoiceAutoCompleteAnswerFormat.fromJson(json);
case MultipleDoubleAnswerFormat.type:
return MultipleDoubleAnswerFormat.fromJson(json);
default:
throw Exception('Unknown type: $type');
}
}