buildVdsAsXml method

String buildVdsAsXml(
  1. String? language
)

Builds a representation of the VDS, in a XML format.

param language The expected language. return The result. throws BiosealException An error has occurred during Bioseal Library execution.

Implementation

String buildVdsAsXml(String? language) {
  Pointer<Char>? pLanguage = language?.toNativeUtf8().cast<Char>();
  Pointer<Char> pResult = nullptr;
  Pointer<Int> pResultSize = calloc.allocate(1);
  pResultSize[0] = -1;
  try {
    var err = biosealSDK.id3Bioseal_BuildVdsAsXml(_pHandle.value, pLanguage ?? nullptr, pResult, pResultSize);
    if (err == BiosealError.insufficientBuffer.value) {
      pResult = calloc.allocate(pResultSize.value);
      err = biosealSDK.id3Bioseal_BuildVdsAsXml(_pHandle.value, pLanguage ?? nullptr, pResult, pResultSize);
      if (err != BiosealError.success.value) {
        throw BiosealException(err);
      }
    }
    final vResult = utf8.decode(Uint8List.fromList(pResult.cast<Uint8>().asTypedList(pResultSize.value)));
    return vResult;
  } finally {
    if (pLanguage != null) {
      calloc.free(pLanguage);
    }
    calloc.free(pResult);
    calloc.free(pResultSize);
  }
}