Routable class
A routable server that can handle dynamic requests.
- Inheritance
-
- Object
- Router<
RequestHandler> - Routable
- Implementers
Constructors
- Routable([Reflector? reflector])
Properties
- configuration → Map
-
A Map of application-specific data that can be accessed.
final
- container → Container
-
A
Container
used to inject dependencies.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
-
middleware
→ List<
RequestHandler> -
no setterinherited
-
mounted
→ Map<
Pattern, Router< RequestHandler> > -
no setterinherited
-
onService
→ Stream<
Service> -
Fired whenever a service is added to this instance.
no setter
-
routes
→ List<
Route< RequestHandler> > -
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
services
→ Map<
Pattern, Service> -
A set of
Service
objects that have been mapped into routes.no setter
Methods
-
addRoute(
String method, String path, RequestHandler handler, {Iterable< RequestHandler> middleware = const {}}) → Route<RequestHandler> -
Adds a route that responds to the given path
for requests with the given method (case-insensitive).
Provide '*' as the method to respond to all methods.
override
-
all(
String path, RequestHandler handler, {Iterable< RequestHandler> middleware = const []}) → Route<RequestHandler> -
Adds a route that responds to any request matching the given path.
inherited
-
chain(
Iterable< RequestHandler> middleware) → ChainedRouter<RequestHandler> -
Prepends the given
middleware
to any routes created by the resulting router.inherited -
clone(
) → Router< RequestHandler> -
Returns a Router with a duplicated version of this tree.
inherited
-
close(
) → void -
delete(
String path, RequestHandler handler, {Iterable< RequestHandler> middleware = const []}) → Route<RequestHandler> -
Adds a route that responds to a DELETE request.
inherited
-
dumpTree(
{dynamic callback(String tree)?, String header = 'Dumping route tree:', String tab = ' '}) → void -
Creates a visual representation of the route hierarchy and
passes it to a callback. If none is provided,
print
is called.inherited -
enableCache(
) → void -
Enables the use of a cache to eliminate the overhead of consecutive resolutions of the same path.
inherited
-
findHookedService<
T extends Service> (Pattern path) → HookedService< dynamic, dynamic, T> ? - Shorthand for finding a HookedService in a statically-typed manner.
-
findService<
T extends Service> (Pattern path) → T? - Retrieves the service assigned to the given path.
-
findServiceOf<
Id, Data> (Pattern path) → Service< Id, Data> ? - Shorthand for finding a Service in a statically-typed manner.
-
get(
String path, RequestHandler handler, {Iterable< RequestHandler> middleware = const []}) → Route<RequestHandler> -
Adds a route that responds to a GET request.
inherited
-
group(
String path, void callback(Router< RequestHandler> router), {Iterable<RequestHandler> middleware = const [], String name = ''}) → SymlinkRoute<RequestHandler> -
Creates a route, and allows you to add child routes to it
via a Router instance.
inherited
-
groupAsync(
String path, FutureOr< void> callback(Router<RequestHandler> router), {Iterable<RequestHandler> middleware = const [], String name = ''}) → Future<SymlinkRoute< RequestHandler> > -
Asynchronous equivalent of group.
inherited
-
head(
String path, RequestHandler handler, {Iterable< RequestHandler> middleware = const []}) → Route<RequestHandler> -
Adds a route that responds to a HEAD request.
inherited
-
mount(
String path, Router< RequestHandler> router) → SymlinkRoute<RequestHandler> -
Incorporates another Router's routes into this one's.
inherited
-
Generates a URI string based on the given input.
Handy when you have named routes.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
options(
String path, RequestHandler handler, {Iterable< RequestHandler> middleware = const {}}) → Route<RequestHandler> -
Adds a route that responds to a OPTIONS request.
inherited
-
patch(
String path, RequestHandler handler, {Iterable< RequestHandler> middleware = const []}) → Route<RequestHandler> -
Adds a route that responds to a PATCH request.
inherited
-
post(
String path, RequestHandler handler, {Iterable< RequestHandler> middleware = const []}) → Route<RequestHandler> -
Adds a route that responds to a POST request.
inherited
-
put(
String path, RequestHandler handler, {Iterable< RequestHandler> middleware = const []}) → Route -
Adds a route that responds to a PUT request.
inherited
-
resolve(
String absolute, String relative, List< RoutingResult< out, {String method = 'GET', bool strip = true}) → boolRequestHandler?> > -
Finds the first Route that matches the given path,
with the given method.
inherited
-
resolveAbsolute(
String path, {String method = 'GET', bool strip = true}) → Iterable< RoutingResult< RequestHandler> > -
Returns the result of resolve with
path
passed as bothabsolute
andrelative
.inherited -
resolveAll(
String absolute, String relative, {String method = 'GET', bool strip = true}) → Iterable< RoutingResult< RequestHandler> > -
Finds every possible Route that matches the given path,
with the given method.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
use<
Id, Data, T extends Service< (Id, Data> >String path, T service) → HookedService< Id, Data, T> -
Mounts a
service
at the givenpath
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited