getDocumentDescription method
- String? language
Gets the description of the document.
param language The expected language. return The description of the document. throws BiosealException An error has occurred during Bioseal Library execution.
Implementation
String getDocumentDescription(String? language) {
Pointer<Char>? pLanguage = language?.toNativeUtf8().cast<Char>();
Pointer<Char> pDocumentDescription = nullptr;
Pointer<Int> pDocumentDescriptionSize = calloc.allocate(1);
pDocumentDescriptionSize[0] = -1;
try {
var err = biosealSDK.id3BiosealManifest_GetDocumentDescription(_pHandle.value, pLanguage ?? nullptr, pDocumentDescription, pDocumentDescriptionSize);
if (err == BiosealError.insufficientBuffer.value) {
pDocumentDescription = calloc.allocate(pDocumentDescriptionSize.value);
err = biosealSDK.id3BiosealManifest_GetDocumentDescription(_pHandle.value, pLanguage ?? nullptr, pDocumentDescription, pDocumentDescriptionSize);
if (err != BiosealError.success.value) {
throw BiosealException(err);
}
}
final vDocumentDescription = utf8.decode(Uint8List.fromList(pDocumentDescription.cast<Uint8>().asTypedList(pDocumentDescriptionSize.value)));
return vDocumentDescription;
} finally {
if (pLanguage != null) {
calloc.free(pLanguage);
}
calloc.free(pDocumentDescription);
calloc.free(pDocumentDescriptionSize);
}
}