RelationSectionWidget class

One published relation, rendered on the record-detail screen as a labelled section: the relation's label, its first page of rows, and a "See all" affordance when the relation holds more than that page. The full paginated screen that affordance opens is RelationListScreen.

Fetches its own first page independently of the record's own load, via fetch — bound by the caller (ResourceViewScreen) to ResourceViewProvider.loadRelation, the same read path every other list in this package uses, so there is nothing a host has to wire for a published relation to render. One section's slow or failing endpoint never blocks or blanks its siblings, because each owns its own request and its own loading/empty/failure state.

Zero rows and an absent relation are different statements and must not look the same: this widget renders whenever the server published the relation (see ResourceViewScreen, which builds one section per entry in resource.relations), and shows FilamentStrings.relationEmpty rather than nothing when a real, successful load comes back with no rows.

A failed load degrades to FilamentStrings.relationFailed, never an infinite spinner — the pilot recorded in docs/superpowers/HANDOFF.md once shipped a permanent spinner for a load that "succeeded" against a resource the signed-in user could not see. This widget's catch — which wraps only the await fetch(), never the trivial field reads after it — is what keeps that from happening again.

Inheritance

Constructors

RelationSectionWidget({required RelationDescriptor relation, required Object recordId, required Future<PaginatedRecords> fetch({int page}), ResourceViewProvider? parent, FilamentStrings strings = const FilamentStrings(), void onSeeAllTap(RelationDescriptor relation, Object recordId)?, Key? key})
const

Properties

fetch Future<PaginatedRecords> Function({int page})
Loads one page of this relation, already parsed — bound by the caller to ResourceViewProvider.loadRelation. page defaults to 1 here (this section only ever shows the first page); RelationListScreen reuses the same signature to page further.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onSeeAllTap → void Function(RelationDescriptor relation, Object recordId)?
Called with relation and recordId when "See all" is tapped. A host that never wires this up gets no button at all — absence means unavailable, never a rendered control that silently no-ops on tap.
final
parent ResourceViewProvider?
The provider holding the record this section hangs off (P9). When it finishes a reload — a record action that changed relation membership is the case that motivated this — the section re-fetches its rows through fetch, so stale membership never survives the action that changed it. Null keeps the load-once-in-initState behaviour: a caller without the provider (a test, a host composing the widget itself) loses the refresh, nothing else.
final
recordId Object
The parent record's id, carried through to onSeeAllTap — this widget never sends it anywhere itself; fetch is already bound to it by the caller.
final
relation RelationDescriptor
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
strings FilamentStrings
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<RelationSectionWidget>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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