getLicensePath static method

String getLicensePath()

Retrieves the license path.

return The license path. throws BiosealException An error has occurred during Bioseal Library execution.

Implementation

static String getLicensePath() {
  Pointer<Char> pLicensePath = calloc.allocate(256);
  Pointer<Int> pLicensePathSize = calloc.allocate(1);
  pLicensePathSize[0] = 256;
  try {
    var err = biosealSDK.id3BiosealLicense_GetLicensePath(pLicensePath, pLicensePathSize);
    if (err == BiosealError.insufficientBuffer.value) {
      calloc.free(pLicensePath);
      pLicensePath = calloc.allocate(pLicensePathSize.value);
      err = biosealSDK.id3BiosealLicense_GetLicensePath(pLicensePath, pLicensePathSize);
      if (err != BiosealError.success.value) {
        throw BiosealException(err);
      }
    }
    final vLicensePath = utf8.decode(Uint8List.fromList(pLicensePath.cast<Uint8>().asTypedList(pLicensePathSize.value)));
    return vLicensePath;
  } finally {
    calloc.free(pLicensePath);
    calloc.free(pLicensePathSize);
  }
}