ResourceController mixin

Contract for controllers that expose Laravel-style resource routes.

A resource controller declares up to four view-building methods that MagicRoute.resource() wires into canonical routes:

Method Path
index() GET /{resource}
create() GET /{resource}/create
show(id) GET /{resource}/:id
edit(id) GET /{resource}/:id/edit

Controllers may override resourceMethods to expose only a subset. Non-exposed methods stay as UnimplementedError fallbacks.

class MonitorController extends MagicController with ResourceController {
  @override
  Widget index() => const MonitorsIndexView();

  @override
  Widget show(String id) => MonitorShowView(id: id);

  @override
  Set<String> get resourceMethods => const {'index', 'show'};
}

Properties

hashCode int
The hash code for this object.
no setterinherited
resourceMethods Set<String>
The set of resource methods this controller exposes. Defaults to all four (index, create, show, edit). Override to limit registration.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

create() Widget
Render the create form (GET /{resource}/create).
edit(String id) Widget
Render the edit form (GET /{resource}/:id/edit).
index() Widget
Render the collection view (GET /{resource}).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
show(String id) Widget
Render a single resource (GET /{resource}/:id).
toString() String
A string representation of this object.
inherited

Operators

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