RiftQuery<E> class
Fluent query builder for Rift boxes.
RiftQuery provides a chainable, type-safe API for filtering, sorting, and limiting query results. It can optionally leverage secondary indexes for faster lookups.
Usage:
final adults = await box.query()
.where('age', greaterThan: 18)
.where('city', equalTo: 'Cairo')
.sortBy('name')
.limit(10)
.findAll();
// Live query — auto-updating stream
box.query()
.where('age', greaterThan: 18)
.watch()
.listen((results) => print('Found ${results.length} adults'));
Constructors
-
RiftQuery(BoxBaseImpl<
E> _box, IndexManager _indexManager) -
Create a new query for the given
box.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clone(
) → RiftQuery< E> - Create a copy of this query with the same filters and sorts.
-
count(
) → Future< int> - Count the number of matching results.
-
findAll(
) → Future< List< E> > - Execute the query and return all matching results.
-
findFirst(
) → Future< E?> - Execute the query and return the first match or null.
-
limit(
int count) → RiftQuery< E> - Set the maximum number of results.
-
noIndex(
) → RiftQuery< E> - Disable index usage for this query.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
offset(
int count) → RiftQuery< E> - Set the number of results to skip.
-
sortBy(
String field, [SortOrder order = SortOrder.asc]) → RiftQuery< E> - Add sort order.
-
sortByDesc(
String field) → RiftQuery< E> - Add descending sort order.
-
toString(
) → String -
A string representation of this object.
override
-
watch(
{Duration debounceDuration = const Duration(milliseconds: 10)}) → Stream< List< E> > - Watch query results as a reactive stream.
-
where(
String field, {dynamic equalTo, dynamic greaterThan, dynamic lessThan, dynamic greaterThanOrEqual, dynamic lessThanOrEqual, List? inList, String? contains, String? startsWith}) → RiftQuery< E> - Add a filter condition.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited