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