stepFromJson function

KnownStep stepFromJson(
  1. Map<String, dynamic> json
)

Helper to parse a step from JSON

Implementation

KnownStep stepFromJson(Map<String, dynamic> json) {
  final type = json['type'] as String;
  switch (type) {
    case 'welcome':
      return WelcomeStep.fromJson(json);
    case 'document':
      return DocumentStep.fromJson(json);
    case 'facePhoto':
      return FacePhotoStep.fromJson(json);
    case 'faceVideo':
      return FaceVideoStep.fromJson(json);
    case 'faceMotion':
      return FaceMotionStep.fromJson(json);
    case 'proofOfAddress':
      return ProofOfAddressStep.fromJson(json);
    default:
      throw ArgumentError('Unknown step type: $type');
  }
}