getModuleName static method

String getModuleName(
  1. int index
)

Retrieves the name of the specified license module.

param index Index of the module, starting from 0. return The license module name. throws DocumentException An error has occurred during Document Library execution.

Implementation

static String getModuleName(int index) {
  Pointer<Char> pName = calloc.allocate(256);
  Pointer<Int> pNameSize = calloc.allocate(1);
  pNameSize[0] = 256;
  try {
    var err = documentSDK.id3DocumentLicense_GetModuleName(index, pName, pNameSize);
    if (err == DocumentError.insufficientBuffer.value) {
      calloc.free(pName);
      pName = calloc.allocate(pNameSize.value);
      err = documentSDK.id3DocumentLicense_GetModuleName(index, 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);
  }
}