getLicenseName static method

String getLicenseName()

Retrieves the license name.

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

Implementation

static String getLicenseName() {
  Pointer<Char> pLicenseName = calloc.allocate(256);
  Pointer<Int> pLicenseNameSize = calloc.allocate(1);
  pLicenseNameSize[0] = 256;
  try {
    var err = documentSDK.id3DocumentLicense_GetLicenseName(pLicenseName, pLicenseNameSize);
    if (err == DocumentError.insufficientBuffer.value) {
      calloc.free(pLicenseName);
      pLicenseName = calloc.allocate(pLicenseNameSize.value);
      err = documentSDK.id3DocumentLicense_GetLicenseName(pLicenseName, pLicenseNameSize);
      if (err != DocumentError.success.value) {
        throw DocumentException(err);
      }
    }
    final vLicenseName = utf8.decode(Uint8List.fromList(pLicenseName.cast<Uint8>().asTypedList(pLicenseNameSize.value)));
    return vLicenseName;
  } finally {
    calloc.free(pLicenseName);
    calloc.free(pLicenseNameSize);
  }
}