get method

String get(
  1. String? key
)

Gets an item of the DecryptionArgs object.

param key Unique key of the item to get. return item to get. throws BiosealException An error has occurred during Bioseal Library execution.

Implementation

String get(String? key) {
  Pointer<Char>? pKey = key?.toNativeUtf8().cast<Char>();
  Pointer<Char> pItem = nullptr;
  Pointer<Int> pItemSize = calloc.allocate(1);
  pItemSize[0] = -1;
  try {
    var err = biosealSDK.id3BiosealDecryptionArgs_Get(_pHandle.value, pKey ?? nullptr, pItem, pItemSize);
    if (err == BiosealError.insufficientBuffer.value) {
      pItem = calloc.allocate(pItemSize.value);
      err = biosealSDK.id3BiosealDecryptionArgs_Get(_pHandle.value, pKey ?? nullptr, pItem, pItemSize);
      if (err != BiosealError.success.value) {
        throw BiosealException(err);
      }
    }
    final vItem = utf8.decode(Uint8List.fromList(pItem.cast<Uint8>().asTypedList(pItemSize.value)));
    return vItem;
  } finally {
    if (pKey != null) {
      calloc.free(pKey);
    }
    calloc.free(pItem);
    calloc.free(pItemSize);
  }
}