getValue method

String getValue()

Gets the value of the text field.

return Value of the text field. throws DocumentException An error has occurred during Document Library execution.

Implementation

String getValue() {
  Pointer<Char> pValue = nullptr;
  Pointer<Int> pValueSize = calloc.allocate(1);
  pValueSize[0] = -1;
  try {
    var err = documentSDK.id3DocumentTextField_GetValue(_pHandle.value, pValue, pValueSize);
    if (err == DocumentError.insufficientBuffer.value) {
      pValue = calloc.allocate(pValueSize.value);
      err = documentSDK.id3DocumentTextField_GetValue(_pHandle.value, pValue, pValueSize);
      if (err != DocumentError.success.value) {
        throw DocumentException(err);
      }
    }
    final vValue = utf8.decode(Uint8List.fromList(pValue.cast<Uint8>().asTypedList(pValueSize.value)));
    return vValue;
  } finally {
    calloc.free(pValue);
    calloc.free(pValueSize);
  }
}