Response class

Models an HTTP Response Steward processes this response and writes out the necessary data to the live HTTP response.

Constructors

Response(int statusCode, {String? body, bool persistent = false})
General constructor, sets the status code and body.
Response.BadRequest([String? body])
Constructor for 400 bad request responses.
Response.Boom([String? body])
Alternative Constructor for 500 internal server error responses.
Response.Created([String? body])
Constructor for 201 Created responses.
Response.Forbidden([String? body])
Constructor for 403 forbidden responses.
Response.InternalServerError([String? body])
Constructor for 500 internal server error responses.
Response.Json(Jsonable jsonable, {int statusCode = HttpStatus.ok})
Typesafe constructor for a response for a jsonable
Response.NotFound([String? body])
Constructor for 404 not found responses.
Response.Ok([String? body])
Constructor for 200 OK responses.
Response.Redirect(String location)
Constructor for 302 redirect responses.
Response.RedirectForever(String location)
Constructor for 303 redirect responses.
Response.Unauthorized([String? body])
Constructor for 401 unauthorized responses.
Response.View(String templateString, {int statusCode = HttpStatus.ok, Map<String, dynamic> varMap = const {}})
Render a template from a template string. Templates can be inlined or looked up from a template

Properties

body String?
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
headers Headers
getter/setter pair
persistent bool
Whether the connection should be persistent or not
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusCode int
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setCookies(List<Cookie> cookies) → void
Sets the cookies on the response as headers
toString() String
A string representation of this object.
inherited

Operators

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