EngineRoute class

The final route structure after combining everything:

This class represents a compiled and configured route within the routing engine.

Constructors

EngineRoute({required String method, required String path, required Handler handler, required RoutePatternRegistry patternRegistry, String? name, List<Middleware> middlewares = const [], Map<String, dynamic> constraints = const {}, RouteSchema? schema, bool isFallback = false, String? sourceFile, int? sourceLine, int? sourceColumn})
Creates a new route with the given properties.
EngineRoute.fallback({required Handler handler, required RoutePatternRegistry patternRegistry, List<Middleware> middlewares = const []})
Creates a fallback route.

Properties

cachedHandlers List<Middleware>
no setter
constraints Map<String, dynamic>
Route constraints for additional matching rules.
final
handler Handler
Request handler function.
final
hashCode int
The hash code for this object.
no setterinherited
hasMiddlewareReference bool
Whether this route has unresolved middleware references.
latefinal
isFallback bool
Whether this is a fallback route.
final
isStatic bool
Whether this route has a static path without params or wildcards.
latefinal
method String
HTTP method (GET, POST, etc.).
final
middlewares List<Middleware>
List of middleware to apply.
final
name String?
Optional route name for URL generation.
final
path String
URL path pattern.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
schema RouteSchema?
Optional API schema metadata for this route.
final
sourceColumn int?
1-based source column where this route was registered.
final
sourceFile String?
Source file where this route was registered.
final
sourceLine int?
1-based source line where this route was registered.
final
staticPath String
Static path for fast lookup when isStatic is true.
latefinal

Methods

cacheHandlers(List<Middleware> globalMiddlewares, {bool cacheable = true}) → void
composeHandlers(List<Middleware> globalMiddlewares, List<Middleware> routeMiddlewares) List<Middleware>
extractParameters(String uri) Map<String, dynamic>
Extracts parameters from a URI string.
matches(HttpRequest request) bool
Checks if a request matches this route.
matchesPath(String path, {bool allowTrailingSlash = true}) bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paramsWithInfo(String uri) List<({ParamInfo info, String key, dynamic value})>
Extracts parameters with their type information from a URI.
toString() String
A string representation of this object.
override
tryMatch(HttpRequest request, {bool checkMethodOnly = false}) → RouteMatch?
Attempts to match a request to this route.
validateConstraints(HttpRequest request) bool
Validates route constraints against a request.

Operators

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