Relation class final

Declares explicit navigation and optionally a physical foreign key.

On a scalar field, use key for the target field. On a class, use ordered fields and keys; each pair is validated for type, storage and codec. The target must be reachable through a model source, export or relation. Relations never become DTO fields or automatically loaded placeholders.

Constructors

Relation({required Type target, required String name, String? key, List<String> fields = const [], List<String> keys = const [], String? inverse, ReferentialAction onDelete = ReferentialAction.restrict, bool constraint = true})
Declares a checked relation whose loading remains explicit.
const

Properties

constraint → bool
Whether to create a database foreign key, rather than read-only navigation.
final
fields → List<String>
Local fields for class-level composite relations.
final
hashCode → int
The hash code for this object.
no setterinherited
inverse → String?
Optional reverse navigation; it does not create a second foreign key.
final
key → String?
Target field for a single-field relation; defaults to its primary key.
final
keys → List<String>
Ordered target fields; defaults to the target primary key.
final
name → String
Generated navigation member on this model's query fields.
final
onDelete → ReferentialAction
Physical deletion action when constraint is true.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
target → Type
Original annotated target class.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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