startLivenessDetectionOnlySDK method
Future<BlusaltLivenessResultResponse?>
startLivenessDetectionOnlySDK({
- required String apiKey,
- required String appName,
- required String clientId,
- required bool isDev,
- LivenessDetectionOnlyType livenessDetectionOnlyType = LivenessDetectionOnlyType.motional,
- bool? startProcessOnGettingToFirstScreen,
- int? timeoutDurationInSec,
override
livenessDetectionOnlyType
can be LivenessDetectionOnlyType.motional or LivenessDetectionOnlyType.still or LivenessDetectionOnlyType.flash
timeoutDurationInSec
this value can be used top override the timeout duration of networks calls in the SDK.
When set to null or no value is passed, it will use the default value from SDK 120s.. @override
Implementation
Future<BlusaltLivenessResultResponse?> startLivenessDetectionOnlySDK(
{required String apiKey,
required String appName,
required String clientId,
required bool isDev,
LivenessDetectionOnlyType livenessDetectionOnlyType =
LivenessDetectionOnlyType.motional,
bool? startProcessOnGettingToFirstScreen,
int? timeoutDurationInSec}) async {
try {
final result =
await methodChannel.invokeMethod('startLivenessDetectionOnlySDK', {
'apiKey': apiKey,
'appName': appName,
'clientId': clientId,
'isDev': isDev,
'livenessType': livenessDetectionOnlyType.name.toUpperCase(),
'startProcessOnGettingToFirstScreen':
startProcessOnGettingToFirstScreen ?? false,
'timeoutDurationInSec': timeoutDurationInSec,
});
if (result != null) {
var response = json.decode(result);
var originalByteDataInString =
(response['faceDetectionData']?['originalLivenessImage'] ??
'')
.toString();
var byteDataInString =
(response['faceDetectionData']?['livenessImage'] ?? '').toString();
return BlusaltLivenessResultResponse(
livenessResultType: BlusaltLivenessResultType.success,
isPassProcedureValidation:
response['isProcedureValidationPassed'] ?? false,
faceDetectionData: BlusaltFaceDetectionData(
isPassFaceGenuiness: response['faceDetectionData']
['isPassFaceGenuineness'],
originalLivenessImageByteWithBg: originalByteDataInString,
imageByte: byteDataInString));
} else {
return BlusaltLivenessResultResponse(
livenessResultType: BlusaltLivenessResultType.error,
message: "Something went wrong");
}
} on PlatformException catch (exception) {
return BlusaltLivenessResultResponse(
livenessResultType: BlusaltLivenessResultType.error,
exception: exception,
message: exception.message,
code: exception.code);
} catch (e) {
return BlusaltLivenessResultResponse(
livenessResultType: BlusaltLivenessResultType.error,
message: e.toString());
}
}