ResponseWrapper class

Wraps the response and captures the response data for caching or inspection.

This wrapper extends the modular Response class and provides additional functionality for capturing response data without sending it immediately.

Inheritance
Available extensions

Constructors

ResponseWrapper(HttpRequest raw)

Properties

body ResponseBody
Access to body content functionality
no setterinherited
capturedData → dynamic
Gets the captured response data if available.
no setter
cookieHandler Cookies
Cookie management
no setterinherited
data ↔ dynamic
getter/setter pair
hasCapturedData bool
Checks if response data has been captured.
no setter
hashCode int
The hash code for this object.
no setterinherited
headers ResponseHeaders
Access to header management functionality
no setterinherited
raw HttpRequest
Raw HttpRequest from Dart SDK
no setterinherited
renderer ResponseRenderer
Access to view rendering functionality
no setterinherited
request Request?
The request object associated with this response.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sent bool
Whether the response has already been sent.
no setterinherited
statusCode int
Access to response status functionality
no setterinherited
statusManager ResponseStatus
Access to status code management functionality
no setterinherited

Methods

accepted() Response
inherited
back({String fallback = '/'}) Future<void>
Redirects back to the previous page.
inherited
badRequest() Response
Sets common error status codes
inherited
bytes(List<int> bytes, {String contentType = 'application/octet-stream'}) → void
Sends binary data (convenience method).
inherited
cache(String value) Response
Sets cache control headers (convenience method)
inherited
clearCapturedData() → void
Clears the captured data.
Sets a cookie (convenience method).
inherited
cors({String? allowOrigin, String? allowMethods, String? allowHeaders, String? exposeHeaders, bool allowCredentials = false, int? maxAge}) Response
Sets CORS headers (convenience method)
inherited
created() Response
inherited
download(File file, {String? name, bool inline = false, String? contentType}) Future<void>
Sends a file download response.
inherited
empty() → void
Sends an empty response (convenience method).
inherited
file(File file, {String? contentType}) Future<void>
Sends a file response.
inherited
flashInput(Map<String, dynamic> inputData) Response

Available on Response, provided by the ResponseExtensions extension

Flash input data to session for next request inputData Map of old input values
forbidden() Response
inherited
format(Map<String, Function> formats) Future<void>
Content negotiation helper.
inherited
gzip() Response
Enables Gzip compression for the response.
inherited
Adds a response header (convenience method).
inherited
html(String html) → void
Alias for sendHtml.
inherited
internalServerError() Response
inherited
json(dynamic data) → void
Alias for sendJson.
inherited
jsonPretty(dynamic data, {int indent = 2}) → void
Sends a pretty-printed JSON response (convenience method).
inherited
noCache() Response
Sets no-cache headers (convenience method)
inherited
noContent() Response
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notFound() Response
inherited
ok() Response
Sets common success status codes
inherited
problem({required String title, required int status, String? detail, String? type, String? instance, Map<String, dynamic>? extensions}) → void
Sends a Problem Details response (RFC 7807).
inherited
redirect(String url, {int status = 302}) Future<void>
Redirects to another URL (convenience method).
inherited
security({bool enableHsts = false, bool enableCsp = false, bool enableXFrameOptions = true, bool enableXContentTypeOptions = true, String? cspPolicy}) Response
Sets security headers (convenience method)
inherited
send(String text) → void
Sends a plain text response (convenience method).
inherited
sendHtml(String html) → void
Sends an HTML response (convenience method).
inherited
sendJson(dynamic data) → void
Sends a JSON response (convenience method).
override
sessionPut(String key, dynamic value) Response

Available on Response, provided by the ResponseExtensions extension

Store a value in the session key The session attribute key value The value to store
setRequest(Request request) → void
Sets the request object associated with this response.
inherited
setStatusCode(int code) Response
Sets the HTTP status code (convenience method).
inherited
status(int code) Response
Sets the HTTP status code (legacy method for backward compatibility).
inherited
stream<T>(Stream<T> stream, {String contentType = 'application/octet-stream', Map<String, String>? headers, List<int> toBytes(T)?}) Future<void>
Streams any type of data to the client (convenience method).
inherited
toString() String
A string representation of this object.
inherited
unauthorized() Response
inherited
view(String viewName, {Map<String, dynamic> data = const {}}) Future<void>
Renders a view template (convenience method).
inherited
withHeaders(Map<String, String> headers) Response
Sets multiple headers (convenience method).
inherited

Operators

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