verifyMatch method Null safety

MatchResult verifyMatch(
  1. Template template1,
  2. Template template2
)

Compare two templates (template1, template2).

The order of templates does not matter. Only the templates that were created with the same method (i.e. with the same ini_file) can be compared.

Implementation

MatchResult verifyMatch(Template template1, Template template2) {
  var exception = _getException();
  final get = _dll_handle.lookupFunction<_Recognizer_verifyMatch_v2_c, _Recognizer_verifyMatch_v2_dart>(_c_namespace + 'Recognizer_verifyMatch_v2');

  Pointer<Double> distance = malloc.allocate(sizeOf<Pointer<Double>>());
  Pointer<Double> score = malloc.allocate(sizeOf<Pointer<Double>>());
  Pointer<Double> frr = malloc.allocate(sizeOf<Pointer<Double>>());
  Pointer<Double> far = malloc.allocate(sizeOf<Pointer<Double>>());
  get(_impl, template1._impl, template2._impl, distance, far, frr, score, exception);
  checkException(exception, _dll_handle);

  MatchResult result = MatchResult(distance.value, far.value, frr.value, score.value);
  malloc.free(distance);
  malloc.free(score);
  malloc.free(frr);
  malloc.free(far);
  return result;
}