Step.fromJson constructor

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

Implementation

factory Step.fromJson(Map<String, dynamic> json) {
  final type = json['type'];
  if (type == 'intro') {
    return InstructionStep.fromJson(json);
  } else if (type == 'question') {
    return QuestionStep.fromJson(json);
  } else if (type == 'completion') {
    return CompletionStep.fromJson(json);
  }
  throw StepNotDefinedException();
}