IQuery class abstract interface

Abstract interface for all query types.

Queries are used to filter entities based on field values. Each query type implements the matches method to determine if a data map satisfies the query criteria.

Usage

Queries are typically constructed using QueryBuilder rather than instantiated directly:

final query = QueryBuilder()
    .whereEquals('status', 'active')
    .whereGreaterThan('age', 18)
    .build();

// Check if entity matches
final data = entity.toMap();
if (query.matches(data)) {
  // Entity matches the query
}

Serialization

All queries support serialization via toMap and deserialization via IQuery.fromMap, enabling query persistence and network transfer.

Implementers
Available extensions
Annotations
  • @immutable

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

executeWithCache(QueryCache<T> cache, Future<List<T>> executeQuery(), {Duration? ttl}) → Future<List<T>>

Available on IQuery, provided by the QueryCachingExtension extension

Executes the query with caching support.
matches(Map<String, dynamic> data) → bool
Determines if the given data map matches the query criteria.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() → Map<String, dynamic>
Serializes the query to a map for persistence or network transfer.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

fromMap(Map<String, dynamic> map) → IQuery
Deserializes a query from a map.