getManifestUrl method

String getManifestUrl(
  1. Uint8List? tslData
)

Returns the URL to the manifest.

param tslData The TSL data. return The manifest url. throws BiosealException An error has occurred during Bioseal Library execution.

Implementation

String getManifestUrl(Uint8List? tslData) {
  Pointer<UnsignedChar>? pTslData;
  if (tslData != null) {
  	pTslData = calloc.allocate<UnsignedChar>(tslData.length);
  	pTslData.cast<Uint8>().asTypedList(tslData.length).setAll(0, tslData);
  }
  Pointer<Char> pUrl = nullptr;
  Pointer<Int> pUrlSize = calloc.allocate(1);
  pUrlSize[0] = -1;
  try {
    var err = biosealSDK.id3BiosealLotl_GetManifestUrl(_pHandle.value, pTslData ?? nullptr, tslData?.length ?? 0, pUrl, pUrlSize);
    if (err == BiosealError.insufficientBuffer.value) {
      pUrl = calloc.allocate(pUrlSize.value);
      err = biosealSDK.id3BiosealLotl_GetManifestUrl(_pHandle.value, pTslData ?? nullptr, tslData?.length ?? 0, pUrl, pUrlSize);
      if (err != BiosealError.success.value) {
        throw BiosealException(err);
      }
    }
    final vUrl = utf8.decode(Uint8List.fromList(pUrl.cast<Uint8>().asTypedList(pUrlSize.value)));
    return vUrl;
  } finally {
    if (pTslData != null) {
      calloc.free(pTslData);
    }
    calloc.free(pUrl);
    calloc.free(pUrlSize);
  }
}