find<T> method

T? find<T>(
  1. String key
)

Implementation

T? find<T>(String key) {
  if (isClosed) {
    return null;
  }

  T? result;

  _execute((functions, transaction, database) {
    final valuePointer = ffi.calloc<MDB_val>();

    final response = functions.mdbGet(
      transaction,
      database.value,
      mdbFromUint8List(serialize(key)),
      valuePointer,
    );
    if (response == KEY_NOT_EXISTS) {
      print('Key "$key" not registred');
      return;
    }
    ErrorHandler(response);
    result = _localize(valuePointer);
  }, isReadOnly: true);

  return result;
}