getProductReference static method

String getProductReference()

Retrieves the license product reference.

return The product reference. throws DocumentException An error has occurred during Document Library execution.

Implementation

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