Route class

Constructors

Route()
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
mounts → Map<String, RawRequestHandler>
raw handlers added with mount
no setter
routes → List<RouteData>
get list of routes registered
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setRoutes(List<RouteData> routeList) → void
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

copy(String route, dynamic controller) → Route
copy route
delete(String route, dynamic controller) → Route
delete route
disabledCors(dynamic callback()) → void
Route.disabledCors() { Route.get('/ping', controller); });
domain(String domain, dynamic callback()) → void
domain route
enabledCors(dynamic callback()) → void
group of route to enabled cors
files(String path, {String? disk, bool signed = true}) → Route
serve files of a storage disk at GET <path>/<key>. with signed (default) only URLs from Storage().signedUrl() work, others get 403. set the disk url option to the full url of path.
get(String route, dynamic controller) → Route
get route
group(String prefix, dynamic callback()) → void
group route
link route
lock(String route, dynamic controller) → Route
lock route
middleware(List middleware, dynamic callback()) → void
middleware for group of routes
mount(String prefix, RawRequestHandler handler) → void
send every request whose path starts with prefix straight to handler, before routing, middleware and body reading. the handler writes and closes the response itself. Socket.IO uses this for /socket.io/.
options(String route, dynamic controller) → Route
options route
patch(String route, dynamic controller, {Object? body}) → Route
patch route
post(String route, dynamic controller, {Object? body}) → Route
post route
prefix(String prefix) → void
set prefix for the route, this will affect its below routes
propfind(String route, dynamic controller) → Route
propfind route
purge(String route, dynamic controller) → Route
purge route
put(String route, dynamic controller, {Object? body}) → Route
put route
resetWithNewMiddleware(List middleware) → void
set global middleware this will remove previous middleware and update new middleware from input input can be list for single middleware
resource(String route, dynamic controller) → Route
resource route
unlink route
unlock(String route, dynamic controller) → Route
unlock route
unmount(String prefix) → void
remove a handler added with mount
use(dynamic middleware) → void
add global middleware
view(String route, dynamic controller) → Route
view route
websocket(String route, dynamic callback(WebsocketEvent), {List middleware = const <dynamic>[]}) → void
add websocket route For this usage, you must use dox-websocket package.