AnswerFormat.fromJson constructor

AnswerFormat.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory AnswerFormat.fromJson(Map<String, dynamic> json) {
  switch (json['type'] as String) {
    case 'bool':
      return BooleanAnswerFormat.fromJson(json);
    case 'integer':
      return IntegerAnswerFormat.fromJson(json);
    case 'double':
      return DoubleAnswerFormat.fromJson(json);
    case 'text':
      return TextAnswerFormat.fromJson(json);
    case 'date':
      return DateAnswerFormat.fromJson(json);
    case 'single':
      return SingleChoiceAnswerFormat.fromJson(json);
    case 'multiple':
      return MultipleChoiceAnswerFormat.fromJson(json);
    case 'multiple_double':
      return MultipleDoubleAnswerFormat.fromJson(json);
    case 'multiple_auto_complete':
      return MultipleChoiceAutoCompleteAnswerFormat.fromJson(json);
    case 'scale':
      return ScaleAnswerFormat.fromJson(json);
    case 'time':
      return TimeAnswerFormat.fromJson(json);
    case 'agreement':
      return AgreementAnswerFormat.fromJson(json);

    default:
      throw AnswerFormatNotDefinedException();
  }
}