RelationDescriptor class

One relation manager published for a resource: a related list of records rendered as cards, e.g. a banner's tags. Absent from the contract entirely on a server predating P6d — that reads as no relations, not an error.

Constructors

RelationDescriptor({required String key, required String label, required CardLayout card, String recordKey = 'id', String? resource, ResourceSearch search = const ResourceSearch(), List<ResourceSort> sorts = const [], PanelDirection direction = PanelDirection.ltr})
const
RelationDescriptor.fromJson(Map<String, dynamic> json, String path, {PanelDirection direction = PanelDirection.ltr})
direction is not read off json — same rule as ResourceSchema.direction: a relation always inherits its owning resource's direction, propagated by ResourceSchema.fromJson through listFromJson below, one level deeper than PanelSchema.fromJson propagates it into the resource itself.
factory

Properties

card → CardLayout
final
defaultSort → ResourceSort?
The declared default sort, if any — same rule as ResourceSchema.defaultSort. The server applies it when a request carries no sort parameter; the provider sends it explicitly so the active sort is what the menu shows as selected.
no setter
direction → PanelDirection
The owning resource's layout direction, propagated at parse time by ResourceSchema.fromJson — see RelationDescriptor.fromJson. Defaults to PanelDirection.ltr for a directly-constructed relation (tests, and callers building one by hand).
final
hashCode → int
The hash code for this object.
no setterinherited
key → String
final
label → String
final
props → List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
recordKey → String
The CHILD record's own identifier attribute — usually id, sometimes a slug or a uuid. Mirrors ResourceSchema.recordKey, but for the related model on the far end of this relation, which is routinely a different class with a different key.
final
resource → String?
The CHILD resource's key, published only when the relation's child model resolves to exactly one mobile resource (P9) — the resource whose form and permissions block govern this relation's row writes. null (a server predating P9, or a zero/several resource match) means read-only: no write affordance may be drawn without it, and the write endpoints 404 there anyway.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
The relation's published search capability (P11) — the same ResourceSearch the resource block carries, reused. Disabled when the server declares no searchable columns, or publishes no search key at all (a server predating P11).
final
sorts → List<ResourceSort>
The relation's declared sorts (P11) — the same ResourceSort shape the resource block carries. Empty when undeclared or when the server predates P11; the relation list screen draws no sort control then.
final
stringify → bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited

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

Static Methods

listFromJson(Map<String, dynamic> json, String path, {PanelDirection direction = PanelDirection.ltr}) → List<RelationDescriptor>
Parses relations one entry at a time, matching RepeaterComponent._templateFrom: a single malformed relation — missing key/label, a card that is bad or fills no slot, or not even an object — is dropped rather than failing the whole resource. relations itself absent reads as no relations (an older server predating P6d); present but not a list is a genuine contract violation and throws.