makeOCRCall static method
Makes an OCR API call using the document image.
Parameters:
endpoint
: The endpoint URL to obtain the OCR response.documentUri
: The path/URI of the document image on which the OCR call has to be performed.parameters
: A map/json containing key-value pairs of different fraud/malice checks provided by Hyperverge.co.headers
: A map/json containing key-value pairs of different header options provided by Hyperverge.co.onComplete
: A callback functionFunction(HVResponse?, HVError?)
that will be called when the OCR call is complete.
Implementation
static Future<void> makeOCRCall({
required String endpoint,
required String documentUri,
required Map parameters,
required Map headers,
required Function(HVResponse?, HVError?) onComplete,
}) async {
try {
final resMap = await _hvNetworkHelperChannel.invokeMethod(
HyperSnapSDKConstants.networkHelperMakeOCRCall,
{
'endpoint': endpoint,
'documentUri': documentUri,
'parameters': parameters,
'headers': headers,
},
);
final errorObj = resMap['errorObj'];
final resObj = resMap['resultObj'];
final hvError = errorObj.isEmpty ? null : HVError.fromMap(errorObj);
final hvResponse = resObj.isEmpty ? null : HVResponse.fromMap(resObj);
onComplete(hvResponse, hvError);
} catch (e) {
log(e.toString());
}
}