captureResultFromJson function

CaptureResult captureResultFromJson(
  1. Map<String, dynamic> json
)

Parse capture result from JSON

Implementation

CaptureResult captureResultFromJson(Map<String, dynamic> json) {
  final type = json['type'] as String;
  switch (type) {
    case 'facePhoto':
      return FacePhotoCaptureResult.fromJson(json);
    case 'faceVideo':
      return FaceVideoCaptureResult.fromJson(json);
    case 'faceMotion':
      return FaceMotionCaptureResult.fromJson(json);
    case 'document':
      return DocumentCaptureResult.fromJson(json);
    case 'proofOfAddress':
      return ProofOfAddressCaptureResult.fromJson(json);
    default:
      throw ArgumentError('Unknown capture result type: $type');
  }
}