Response<ValueType> class abstract

HTTP response. A route handler must respond to HTTP requests by producing a Response object.

ValueType specializes the value contained by it.

writeResponse can be used to write response to underlying abstracted response object.

Implementers

Constructors

Response({dynamic body, int statusCode = 200, Map<String, dynamic>? headers, String? mimeType, String? charset = kDefaultCharset, List<Cookie>? cookies})
factory

Properties

body ↔ ValueType?
Body of the response
getter/setter pair
cookies List<Cookie>
Cookies
final
hashCode int
The hash code for this object.
no setterinherited
headers JaguarHttpHeaders
Headers
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusCode int
Status code of the response
getter/setter pair

Methods

deleteCookie(String name, {String path = '/'}) → void
deleteCookie deletes a cookie with given name. Use path to specify the path from which the cookie has to be removed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
writeAllButBody(HttpResponse resp) → void
writeResponse(HttpResponse resp) FutureOr<void>
Writes body of the HTTP response from body property

Operators

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

Static Methods

html(String html, {int statusCode = HttpStatus.ok, Map<String, dynamic>? headers, String mimeType = MimeTypes.html, String charset = kDefaultCharset, List<Cookie>? cookies}) StringResponse
json<ST>(ST value, {dynamic serializeWith(ST value)?, int statusCode = HttpStatus.ok, Map<String, dynamic>? headers, String mimeType = MimeTypes.json, String charset = kDefaultCharset, List<Cookie>? cookies}) StringResponse