check static method

bool check(
  1. String? text,
  2. MrzType type
)

Checks the validity of a single line of an MRZ of a given type by checking the check digits.

param text The input MRZ line. param type The input MRZ type according to ICAO-9303 standard. return The result of the verification. throws DocumentException An error has occurred during Document Library execution.

Implementation

static bool check(String? text, MrzType type) {
  Pointer<Char>? pText = text?.toNativeUtf8().cast<Char>();
  Pointer<Bool> pValidity = calloc();
  try {
    var err = documentSDK.id3DocumentMrzHelper_Check(pText ?? nullptr, type.value, pValidity);
    if (err != DocumentError.success.value) {
      throw DocumentException(err);
    }
    final vValidity = pValidity.value;
    return vValidity;
  } finally {
    if (pText != null) {
      calloc.free(pText);
    }
    calloc.free(pValidity);
  }
}