findFirst method

T? findFirst()

Finds the first object matching the query. Returns null if there are no results. Note: offset and limit are respected, if set.

Implementation

T? findFirst() {
  T? result;
  final errorWrapper = ObjectVisitorError();
  visitCallBack(Pointer<Uint8> data, int size) {
    try {
      result = _entity.objectFromData(_store, data, size);
    } catch (e) {
      errorWrapper.error = e;
    }
    return false; // we only want to visit the first element
  }

  visit(_ptr, visitCallBack);
  errorWrapper.throwIfError();
  return result;
}