Response class

Represents the information in an HTTP response.

This object can be used to write an HTTP response and contains conveniences for creating these objects.

Implemented types

Constructors

Response(int statusCode, Map<String, dynamic>? headers, dynamic body)
The default constructor.
Response.accepted({Map<String, dynamic>? headers})
Represents a 202 response.
Response.badRequest({Map<String, dynamic>? headers, dynamic body})
Represents a 400 response.
Response.conflict({Map<String, dynamic>? headers, dynamic body})
Represents a 409 response.
Response.created(String location, {dynamic body, Map<String, dynamic>? headers})
Represents a 201 response.
Response.forbidden({Map<String, dynamic>? headers, dynamic body})
Represents a 403 response.
Response.gone({Map<String, dynamic>? headers, dynamic body})
Represents a 410 response.
Response.noContent({Map<String, dynamic>? headers})
Represents a 204 response.
Response.notFound({Map<String, dynamic>? headers, dynamic body})
Represents a 404 response.
Response.notModified(DateTime lastModified, CachePolicy? cachePolicy)
Represents a 304 response.
Response.ok(dynamic body, {Map<String, dynamic>? headers})
Represents a 200 response.
Response.serverError({Map<String, dynamic>? headers, dynamic body})
Represents a 500 response.
Response.unauthorized({Map<String, dynamic>? headers, dynamic body})
Represents a 401 response.

Properties

body ↔ dynamic
An object representing the body of the Response, which will be encoded when used to Request.respond.
getter/setter pair
bufferOutput bool
Whether or not this instance should buffer its output or send it right away.
getter/setter pair
cachePolicy CachePolicy?
Cache policy that sets 'Cache-Control' headers for this instance.
getter/setter pair
contentType ContentType?
The content type of the body of this response.
getter/setter pair
encodeBody bool
Whether or not the body object of this instance should be encoded.
getter/setter pair
hasExplicitlySetContentType bool
Whether or nor this instance has explicitly has its contentType property.
no setter
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, dynamic>
Map of headers to send in this response.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusCode int?
The HTTP status code of this response.
getter/setter pair

Methods

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

Static Properties

defaultContentType ContentType
The default value of a contentType.
getter/setter pair