getName method

String getName()

Gets the the document type name.

return The document type name. throws DocumentException An error has occurred during Document Library execution.

Implementation

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