ServerContext class
Holds the matched route and request/response pair for processing.
This class serves as the central context for HTTP request processing, containing all the information needed to handle a request from routing to response generation.
Key features:
- Route matching and parameter extraction
- Request/response lifecycle management
- Middleware execution context
- Request timing and profiling
Constructors
- ServerContext({required Request request, Response? response})
Properties
-
allData
→ Map<
String, dynamic> -
Get all custom data
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasMatch → bool
-
Whether a route has been matched for this request
no setter
- matchedRoute → RouteMatchResult?
-
Get the matched route result for the current request
no setter
- processingTime → Duration
-
Duration since the request started processing
no setter
- request → Request
-
final
- response → Response?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearData(
) → void - Clear all custom data
-
getData<
T> (String key) → T? - Retrieve custom data from this request context
-
hasData(
String key) → bool - Check if custom data exists
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeData(
String key) → void - Remove custom data
-
setData(
String key, dynamic value) → void - Store custom data for this request context
-
setMatch(
RouteMatchResult match) → void - Set the matched route for this context
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- current → ServerContext
-
Get the current server context from the zone.
no setter
- hasContext → bool
-
Check if a server context is currently available.
no setter
- zoneKey → Symbol
-
no setter