RestResourceDataSource class

Talks to gait/filament-mobile over a host-supplied FilamentTransport.

Caches the panel document in memory for the life of this instance, because every list and record call needs its resource's recordKey and the document changes far less often than a list is scrolled. Optionally also persists it across restarts and revalidates it with a conditional GET — see cache and cacheKey — through a SchemaCacheStore.

Implemented types

Constructors

RestResourceDataSource({required FilamentTransport transport, String prefix = '/api/mobile-panel', FilamentSchemaCache? cache, String? cacheKey})

Properties

hashCode int
The hash code for this object.
no setterinherited
prefix String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cachedPanel() Future<PanelSchema?>
The cached panel, if there is a usable one — parsed, never rendered from bytes this build cannot read.
override
create(String resourceKey, Map<String, dynamic> values) Future<WriteResult>
POST /{resource} — never throws on a 4xx; see WriteResult.
override
createRelation(String resourceKey, Object id, RelationDescriptor relation, Map<String, dynamic> values) Future<WriteResult>
The three relation-row writes (P9) sit beside relation, the read: same sibling URL family, same never-throw contract as create/update/destroy — a 4xx comes back as data and only a transport failure throws, which the catch folds into WriteFailed exactly the way those three do.
override
dashboard() Future<DashboardData>
GET /dashboard — the panel's widgets, values already computed.
override
deleteRelation(String resourceKey, Object id, RelationDescriptor relation, Object childId) Future<WriteResult>
DELETE /{resource}/{id}/relations/{relation}/{childId} — removes one child row, resolved through the relationship exactly as updateRelation.
override
destroy(String resourceKey, Object id) Future<WriteResult>
DELETE /{resource}/{id} — never throws on a 4xx; see WriteResult.
override
list(String resourceKey, {int page = 1, String? search, String? sort, String? direction}) Future<PaginatedRecords>
GET /{resource}
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
options(String resourceKey, {required String field, Object? recordId, required Map<String, dynamic> values, required String query}) Future<OptionsPage>
POST /{resource}/options — the options for a select whose list /schema refused to inline.
override
panel() Future<PanelSchema>
GET /schema
override
record(String resourceKey, Object id) Future<ResourceRecord>
GET /{resource}/{id} — the only call that returns per-record permissions.
override
relation(String resourceKey, Object id, RelationDescriptor relation, {int page = 1, String? search, String? sort, String? direction}) Future<PaginatedRecords>
One relation manager's rows for record id — the same envelope list parses, against the sibling URL RelationController serves. Unlike list, the child rows' own key comes from relation itself (relation.recordKey), not from this resource's schema: the related model is routinely a different one, with a different route key.
override
runAction(String resourceKey, Object id, String action) Future<ActionResult>
POST /{resource}/{id}/actions/{action} — runs one of the record's own RecordActions. Never throws on a 4xx or 5xx; see ActionResult.
override
state(String resourceKey, {Object? recordId, required Map<String, dynamic> values, required String changed}) Future<List<SchemaComponent>>
POST /{resource}/state — re-evaluates the form against values typed but not yet submitted, so visible/disabled/hidden closures answer on mobile exactly as they do in the web panel.
override
toString() String
A string representation of this object.
inherited
update(String resourceKey, Object id, Map<String, dynamic> values) Future<WriteResult>
PUT /{resource}/{id} — never throws on a 4xx; see WriteResult.
override
updateRelation(String resourceKey, Object id, RelationDescriptor relation, Object childId, Map<String, dynamic> values) Future<WriteResult>
PUT /{resource}/{id}/relations/{relation}/{childId} — updates one child row, resolved through the relationship (P9): childId is the related model's own key (the relation's published recordKey), and a child that is not this parent's answers 404, never a cross-parent write.
override
uploadFile(String resourceKey, String field, {required List<int> bytes, required String filename}) Future<UploadResult>
POST /{resource}/upload — uploads a file for a single-file upload field. field is the field's statePath, so a nested field is addressable.
override

Operators

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