getDocumentName method

String getDocumentName()

Gets the document type to authenticate.

return Document type to authenticate. throws DocumentException An error has occurred during Document Library execution.

Implementation

String getDocumentName() {
  Pointer<Char> pDocumentName = nullptr;
  Pointer<Int> pDocumentNameSize = calloc.allocate(1);
  pDocumentNameSize[0] = -1;
  try {
    var err = documentSDK.id3DocumentAuthenticator_GetDocumentName(_pHandle.value, pDocumentName, pDocumentNameSize);
    if (err == DocumentError.insufficientBuffer.value) {
      pDocumentName = calloc.allocate(pDocumentNameSize.value);
      err = documentSDK.id3DocumentAuthenticator_GetDocumentName(_pHandle.value, pDocumentName, pDocumentNameSize);
      if (err != DocumentError.success.value) {
        throw DocumentException(err);
      }
    }
    final vDocumentName = utf8.decode(Uint8List.fromList(pDocumentName.cast<Uint8>().asTypedList(pDocumentNameSize.value)));
    return vDocumentName;
  } finally {
    calloc.free(pDocumentName);
    calloc.free(pDocumentNameSize);
  }
}