Relation<R, F extends Fields> class
final
A relationship is a query description. Constructing or selecting it performs no I/O. List results are loaded in batches on the root query's connection.
Filters, ordering, pagination, and selections return new descriptions. Each selected relationship can add queries; batching groups distinct parent keys instead of issuing one query per parent. Use a transaction when the root and its batches must share the database's configured snapshot isolation.
Constructors
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
-
any(
) → Expr< bool> - Builds a correlated SQL EXISTS expression for the filtered relationship.
-
count(
) → Expr< int> - Builds a correlated SQL count without fetching related rows into Dart.
-
every(
Expr< bool?> condition(F)) → Expr<bool?> -
Checks that every filtered related row makes
conditionSQL TRUE. -
many(
) → Selection< List< R> > - Selects a list per parent, returning an empty list when no rows match.
-
none(
) → Expr< bool?> - Builds the negation of any, without loading the related rows.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
one(
{ToOneStrategy strategy = ToOneStrategy.automatic}) → Selection< R?> - Selects at most one visible row, or null when no row matches.
-
orderBy(
List< OrderTerm> order(F)) → Relation<R, F> - Replaces related-row ordering; include a stable tie breaker for pagination.
-
required(
{ToOneStrategy strategy = ToOneStrategy.automatic}) → Selection< R> - Requires one visible row while preserving the selected value's nullability.
-
select<
S> (Selection< S> selection(F)) → Relation<S, F> - Replaces each related row's result shape without loading it.
-
skip(
int count) → Relation< R, F> -
Skips
countrows per parent; batched pagination requires orderBy. -
take(
int count) → Relation< R, F> -
Limits each parent's result to
countrows; negative counts are rejected. -
toString(
) → String -
A string representation of this object.
inherited
-
where(
Expr< bool?> predicate(F)) → Relation<R, F> - Adds a SQL predicate to the related rows, combined with earlier filters.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited