buildVdsAsJson method

String buildVdsAsJson(
  1. String? indentation
)

Builds a representation of the VDS, in JSON format.

param indentation The indentation of the json string. return The result. throws BiosealException An error has occurred during Bioseal Library execution.

Implementation

String buildVdsAsJson(String? indentation) {
  Pointer<Char>? pIndentation = indentation?.toNativeUtf8().cast<Char>();
  Pointer<Char> pResult = nullptr;
  Pointer<Int> pResultSize = calloc.allocate(1);
  pResultSize[0] = -1;
  try {
    var err = biosealSDK.id3Bioseal_BuildVdsAsJson(_pHandle.value, pIndentation ?? nullptr, pResult, pResultSize);
    if (err == BiosealError.insufficientBuffer.value) {
      pResult = calloc.allocate(pResultSize.value);
      err = biosealSDK.id3Bioseal_BuildVdsAsJson(_pHandle.value, pIndentation ?? 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 (pIndentation != null) {
      calloc.free(pIndentation);
    }
    calloc.free(pResult);
    calloc.free(pResultSize);
  }
}