add method

void add(
  1. String? key,
  2. String? item
)

Adds an item to the StringDict object.

param key Unique key of the item to add. param item item to add. throws DocumentException An error has occurred during Document Library execution.

Implementation

void add(String? key, String? item) {
  Pointer<Char>? pKey = key?.toNativeUtf8().cast<Char>();
  Pointer<Char>? pItem = item?.toNativeUtf8().cast<Char>();
  try {
    var err = documentSDK.id3DocumentStringDict_Add(_pHandle.value, pKey ?? nullptr, pItem ?? nullptr);
    if (err != DocumentError.success.value) {
      throw DocumentException(err);
    }
  } finally {
    if (pKey != null) {
      calloc.free(pKey);
    }
    if (pItem != null) {
      calloc.free(pItem);
    }
  }
}