Query class

An interface to request data from a Provider or ModelRepository.

Constructors

Query.new({QueryAction? action, List<ProviderQuery<Provider<Model>>> forProviders = const [], int? limit, List<LimitBy> limitBy = const [], int? offset, @Deprecated('Use limit, offset, limitBy, orderBy, or forProviders instead.') Map<String, dynamic> providerArgs = const {}, List<OrderBy> orderBy = const [], List<WhereCondition>? where})
An interface to request data from a Provider or ModelRepository.
const
Query.fromJson(Map<String, dynamic> json)
Deserialize from JSON
factory
Query.where(String evaluatedField, dynamic value, {Compare? compare, bool limit1 = false})
Make a very simple query with a single Where statement. For example Query.where('id', 1).
factory

Properties

action QueryAction?
How this query interacts with its invoking provider.
final
forProviders List<ProviderQuery<Provider<Model>>>
Provider-specific query arguments. Only one ProviderQuery per Provider is permitted.
final
hashCode int
The hash code for this object.
no setteroverride
limit int?
The response should not exceed this number. For advanced cases, see limitBy.
final
limitBy List<LimitBy>
Directions for limiting associated model results before they're returned to the caller. limit will restrict the top-level queried model.
final
offset int?
The response should start at this index.
final
orderBy List<OrderBy>
Directions for sorting results before they're returned to the caller.
final
providerArgs Map<String, dynamic>
Properties that interact with the provider's source. For example, 'limit'. The value must be serializable by jsonEncode.
final
providerQueries Map<Type, ProviderQuery<Provider<Model>>>
Available for Providers to easily access their relevant ProviderQuerys.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
unlimited bool
When limit is undefined or less than 1, the query is considered "unlimited".
no setter
where List<WhereCondition>?
Model properties to be interpreted by the Provider. When creating WhereConditions, the first positional fieldName argument should be the field name, not the name used between the provider and source (e.g. data['last_name']).
final

Methods

copyWith({QueryAction? action, List<ProviderQuery<Provider<Model>>>? forProviders, int? limit, List<LimitBy>? limitBy, int? offset, List<OrderBy>? orderBy, Map<String, dynamic>? providerArgs, List<WhereCondition>? where}) Query
Reconstruct the Query with passed overrides
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serialize to JSON
toString() String
A string representation of this object.
override

Operators

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