estimateLiveness method Null safety

LivenessResult estimateLiveness(
  1. RawSample sample
)

Create a template from detected face sample (from Capturer of VideoWorker).

Implementation

LivenessResult estimateLiveness(final RawSample sample) {
  final process = _dll_handle
      .lookupFunction<_Liveness2DEstimator_estimateLiveness, _Liveness2DEstimator_estimateLiveness>(_c_namespace + 'Liveness2DEstimator_estimateLiveness');
  Pointer<Int32> verdictPtr = malloc.allocate<Int32>(sizeOf<Pointer<Int32>>());
  Pointer<Float> scorePtr = malloc.allocate<Float>(sizeOf<Pointer<Float>>());

  final exception = _getException();
  process(_impl, sample._impl, verdictPtr, scorePtr, exception);

  checkException(exception, _dll_handle);

  int verdictVal = verdictPtr.value;
  double scoreVal = scorePtr.value;

  malloc.free(verdictPtr);
  malloc.free(scorePtr);

  return LivenessResult(verdictVal, scoreVal);
}