askarEntryListGetCategory function

AskarResult<String> askarEntryListGetCategory(
  1. EntryListHandle handle,
  2. int index
)

Implementation

AskarResult<String> askarEntryListGetCategory(EntryListHandle handle, int index) {
  Pointer<Pointer<Utf8>> utf8PtPointer = calloc<Pointer<Utf8>>();

  try {
    final funcResult = nativeAskarEntryListGetCategory(
      handle.toInt(),
      index,
      utf8PtPointer,
    );

    final errorCode = ErrorCode.fromInt(funcResult);

    final String value =
        (errorCode == ErrorCode.success) ? utf8PtPointer.value.toDartString() : "";

    return AskarResult<String>(errorCode, value);
  } finally {
    freeDoublePointer(utf8PtPointer);
  }
}