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 []})
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 []})
direction is not read off json — 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. locales follows the same rule, for the same reason: panel.locales is 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
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 to const [] 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 own translatable form fields.
final
permissions ResourcePermissions
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, sometimes uuid.
final
relations List<RelationDescriptor>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
final
sorts List<ResourceSort>
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