StreamingQuery<T> class

A streaming query that emits new results whenever the underlying data changes.

Uses sophisticated dependency analysis to track exactly which tables and columns this query depends on, ensuring updates only occur when relevant data changes. For complex queries, falls back to table-level dependencies for reliability.

Requires that all queried tables have system_id and system_version columns for proper change detection and object caching optimization.

Constructors

StreamingQuery.create({required String id, required QueryBuilder builder, required DeclarativeDatabase database, required T mapper(Map<String, Object?>)})
Factory constructor to create a streaming query
factory

Properties

cacheSize int
The current size of the result cache
no setter
dependencies QueryDependencies
The dependencies this query has on database entities
no setter
hashCode int
The hash code for this object.
no setterinherited
id String
The unique identifier for this streaming query
no setter
isActive bool
Whether this query is currently active (has listeners)
no setter
lastCacheStats → ({double hitPercentage, int hits, int misses})?
Get the cache statistics from the last refresh operation
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<List<T>>
The stream of query results with automatic replay of last value
no setter
supportsCaching bool
Whether this query supports caching (has system columns and cached data)
no setter

Methods

dispose() Future<void>
Dispose of this streaming query
isAffectedByColumn(String tableName, String columnName) bool
Returns true if this query might be affected by changes to the given column.
isAffectedByTable(String tableName) bool
Returns true if this query might be affected by changes to the given table.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh() Future<void>
Manually trigger a refresh of this query with system column optimization.
toString() String
A string representation of this object.
override
updateQuery({QueryBuilder? newBuilder, T newMapper(Map<String, Object?>)?}) Future<void>
Updates the query builder and mapper with smart lifecycle management.

Operators

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