RouteGroup class final
Groups multiple routes under a common path prefix.
Example:
final apiRoutes = RouteGroup('/api/v1', routes: [
RouteHttp.get('/users', middleware: ...),
RouteHttp.get('/products', middleware: ...),
]);
// Results in routes: /api/v1/users, /api/v1/products
Use flatten to expand the group into a flat list of Route objects
suitable for passing to Sparky.server(routes: ...).
Constructors
-
RouteGroup(String prefix, {required List<
Route> routes, List<MiddlewareNullable> guards = const []})
Properties
-
guards
→ List<
MiddlewareNullable> -
Guards that apply to all routes in this group.
final
- 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
-
flatten(
) → List< Route> - Expands this group into individual routes with the prefix prepended.
-
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