getDocumentType method

String getDocumentType()

Gets the the document type identification code. For AFNOR XP Z42-101 only.

return The document type identification code. For AFNOR XP Z42-101 only. throws BiosealException An error has occurred during Bioseal Library execution.

Implementation

String getDocumentType() {
  Pointer<Char> pDocumentType = nullptr;
  Pointer<Int> pDocumentTypeSize = calloc.allocate(1);
  pDocumentTypeSize[0] = -1;
  try {
    var err = biosealSDK.id3Bioseal_GetDocumentType(_pHandle.value, pDocumentType, pDocumentTypeSize);
    if (err == BiosealError.insufficientBuffer.value) {
      pDocumentType = calloc.allocate(pDocumentTypeSize.value);
      err = biosealSDK.id3Bioseal_GetDocumentType(_pHandle.value, pDocumentType, pDocumentTypeSize);
      if (err != BiosealError.success.value) {
        throw BiosealException(err);
      }
    }
    final vDocumentType = utf8.decode(Uint8List.fromList(pDocumentType.cast<Uint8>().asTypedList(pDocumentTypeSize.value)));
    return vDocumentType;
  } finally {
    calloc.free(pDocumentType);
    calloc.free(pDocumentTypeSize);
  }
}