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

hashCode int
The hash code for this object.
no setterinherited
route String
Route pattern
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
verb String
HTTP method
final

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 path against this route's pattern. Returns a map of extracted parameters if matched, otherwise null.
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