start static method
Starts the face capture process and returns the parsed result.
hvFaceConfig
(optional) is an instance of HVFaceConfig that configures the face capture.
onComplete
is a callback function that receives the HVResponse and HVError objects.
Example usage:
HVFaceCapture.start(
hvFaceConfig: HVFaceConfig(), // Provide the face capture configuration if needed
onComplete: (response, error) {
// Handle the response and error objects
},
);
Implementation
static Future<void> start({
HVFaceConfig? hvFaceConfig,
required void Function(HVResponse?, HVError?) onComplete,
}) async {
Map resMap = {};
HVError? hvError;
HVResponse? hvResponse;
try {
resMap = await _hyperSnapSDKChannel.invokeMethod(
HyperSnapSDKConstants.startFaceCapture,
{
HyperSnapSDKConstants.faceConfig:
hvFaceConfig?.toMap() ?? HVFaceConfig().toMap(),
},
);
Map errorObj = resMap["errorObj"];
Map resObj = resMap["resultObj"];
hvError = (errorObj.isEmpty) ? null : HVError.fromMap(errorObj);
hvResponse = (resObj.isEmpty) ? null : HVResponse.fromMap(resObj);
} catch (e) {
log(e.toString());
}
onComplete(hvResponse, hvError);
}