RouterEntry class
Represents a route entry in the router.
This class encapsulates an HTTP route definition, including its HTTP method, path pattern, request handler, optional middleware, and parameter extraction.
- Supports dynamic route parameters using named placeholders.
- Ensures valid route definitions.
- Provides methods for matching and invoking routes.
Constructors
- RouterEntry(String verb, String route, Handler handler, {MiddlewareFunc? middleware, bool mounted = false})
-
Factory constructor for RouterEntry, which creates and validates a new route entry.
factory
Properties
Methods
-
invoke(
Request request, Map< String, String> params) → Future<Response> - Invokes the registered handler for this route. Applies middleware and extracts parameters before executing the handler.
-
match(
String path) → Map< String, String> ? -
Matches the given
pathagainst this route's pattern. Returns a map of extracted parameters if matched, otherwisenull. -
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