uploadDocument method
Upload document
verificationId - The verification ID
file - The document image file (File on mobile, XFile on web)
side - Document side ('front' or 'back')
Returns SdkVerificationResponse
Implementation
Future<SdkVerificationResponse> uploadDocument({
required String verificationId,
required dynamic file, // File on mobile, XFile on web
required String side, // 'front' or 'back'
}) async {
try {
final response = await _apiClient.postMultipart(
'/sdk/kyc-verification/verifications/$verificationId/documents',
file: file,
fields: {'side': side},
);
final jsonData = json.decode(response.body) as Map<String, dynamic>;
return SdkVerificationResponse.fromJson(jsonData);
} catch (e) {
if (e is ApexKycException) {
rethrow;
}
throw ApexKycException(
'Failed to upload document: ${e.toString()}',
originalError: e,
);
}
}