ResourceSchema class
One Filament resource, rendered as a list of cards plus create/edit/view pages. Construct it directly for a Dart-defined override, or via ResourceSchema.fromJson for the server-served schema — same class, same renderer, one code path.
Constructors
-
ResourceSchema({required String key, required ResourceLabels labels, ResourcePermissions permissions = const ResourcePermissions(), String recordKey = 'id', CardLayout card = const CardLayout.empty(), ResourceSearch search = const ResourceSearch(), List<
ResourceSort> sorts = const [], List<SchemaComponent> filters = const [], List<SchemaComponent> form = const [], List<SchemaComponent> infolist = const [], List<RelationDescriptor> relations = const [], String? group, ResourceBadge? badge, PanelDirection direction = PanelDirection.ltr, List<String> locales = const [], PollConfig? poll, String? channel, ReorderConfig? reorder}) -
const
- ResourceSchema.fake()
-
Shape-only resource for skeleton loading: the UI renders this while
LoadStatus.loading, so the skeleton matches the real card's geometry.factory -
ResourceSchema.fromJson(Map<
String, dynamic> json, String path, {PanelDirection direction = PanelDirection.ltr, List<String> locales = const [], PollConfig? poll}) -
directionis not read offjson— a resource's direction always comes from its panel. It defaults to PanelDirection.ltr so a directly constructed resource (tests, the contract test, ResourceSchema.fake) keeps working unchanged; PanelSchema.fromJson passes the panel's parsed direction into every resource it builds.localesfollows the same rule, for the same reason:panel.localesis a panel-level fact, not a per-resource one, so it is propagated here rather than read off each resource's own JSON (which carries none).factory
Properties
- badge → ResourceBadge?
-
The web sidebar's count badge, or null when the resource declares none
— the server omits the key entirely in that case, same as group.
final
- card → CardLayout
-
final
- channel → String?
-
Private resource change-feed channel. Its presence means the resource
opted into realtime for this authorized schema; null keeps polling.
final
- defaultSort → ResourceSort?
-
no setter
- direction → PanelDirection
-
The owning panel's layout direction, propagated at parse time by
PanelSchema.fromJson. Defaults to PanelDirection.ltr for a
directly-constructed resource — see ResourceSchema.fromJson.
final
-
filters
→ List<
SchemaComponent> -
final
-
form
→ List<
SchemaComponent> -
final
- group → String?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
infolist
→ List<
SchemaComponent> -
final
- key → String
-
final
- labels → ResourceLabels
-
final
-
locales
→ List<
String> -
panel.locales, propagated at parse time by PanelSchema.fromJson — see PanelSchema.locales for the contract. Defaults toconst []for a directly-constructed resource, same as direction. Used only to order a translatable group's chips; the chips themselves come from this resource's owntranslatableform fields.final - permissions → ResourcePermissions
-
final
- poll → PollConfig?
-
The owning panel's opt-in revalidation intervals. Propagated at parse
time like direction and locales; null means no background polling.
final
-
props
→ List<
Object?> -
Identity only: two resources with the same key and group compare equal
even when their labels, permissions, card or form have diverged. Use it to
look a resource up, never to decide whether a refreshed schema differs from
a cached one — it always will not.
no setter
- recordKey → String
-
Attribute holding the record identifier — usually
id, sometimesuuid.final -
relations
→ List<
RelationDescriptor> -
final
- reorder → ReorderConfig?
-
Drag-to-reorder capability (P18) — absent (
null) on almost every resource, present only when the server's/schemaresponse carried thereorderkey for this session.ResourceListScreengates its reorder toggle on this alone — see that screen's class doc for why no host hook is needed the wayonCreateTapneeds one.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- search → ResourceSearch
-
final
-
sorts
→ List<
ResourceSort> -
final
- stringify → bool?
-
If set to
true, thetoStringmethod will be overridden to output this instance'sprops.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