detectLiveness static method

Future<String> detectLiveness({
  1. required String poweredBy,
  2. required int compressQualityiOS,
  3. required int compressQualityandroid,
})

Implementation

static Future<String> detectLiveness(
    {required String poweredBy,
    required String assetLogo,
    required int compressQualityiOS,
    required int compressQualityandroid}) async {
  if (defaultTargetPlatform != TargetPlatform.android &&
      defaultTargetPlatform != TargetPlatform.iOS) {
    throw Exception('platform not supported');
  }
  var response = await _channel.invokeMethod("detectliveliness", {
        "msgselfieCapture": "Place your face inside the oval shaped panel",
        "msgBlinkEye": defaultTargetPlatform == TargetPlatform.iOS
            ? "Blink 3 Times"
            : "Blink Your Eyes",
        "assetPath": assetLogo,
        "poweredBy": poweredBy
      }) ??
      "";
  if (response == "") {
    return "";
  }

  File file = File(response);
  debugPrint("=============>>> imaage ${file.path}");

  try {
    var data = await _compressImage(
        file: file,
        compressQualityandroid: compressQualityandroid,
        compressQualityiOS: compressQualityiOS);

    return data.path;
  } catch (ex) {
    return file.path;
  }
}