verifyFace method

Future<VerificationResponse> verifyFace(
  1. String sessionId,
  2. File video,
  3. VerificationType verificationType
)

Verify face

Implementation

Future<VerificationResponse> verifyFace(
  String sessionId,
  File video,
  VerificationType verificationType,
) async {
  try {
    final Map<String, dynamic> response = await _plugin.verifyFace(
      sessionId,
      {
        'video': video,
      },
      verificationType,
    );

    // Add sessionId to the response if it's not already present
    final responseWithSessionId = Map<String, dynamic>.from(response);
    if (!responseWithSessionId.containsKey('session_id')) {
      responseWithSessionId['session_id'] = sessionId;
    }

    return VerificationResponse.fromJson(responseWithSessionId);
  } catch (e) {
    throw Exception('Failed to verify face: $e');
  }
}