An HTTP response where the entire response body is known in advance.

Inheritance

Static Methods

fromStream(StreamedResponse response) Future<Response>

Creates a new HTTP response by waiting for the full body to become available from a StreamedResponse.

Constructors

Response(String body, int statusCode, { BaseRequest request, Map<String, String> headers: const {}, bool isRedirect: false, bool persistentConnection: true, String reasonPhrase })

Creates a new HTTP response with a string body.

Response.bytes(List<int> bodyBytes, int statusCode, { BaseRequest request, Map<String, String> headers: const {}, bool isRedirect: false, bool persistentConnection: true, String reasonPhrase })

Create a new HTTP response with a byte array body.

Properties

body String

The body of the response as a string. This is converted from bodyBytes using the charset parameter of the Content-Type header field, if available. If it's unavailable or if the encoding name is unknown, LATIN1 is used by default, as per RFC 2616.

read-only
bodyBytes Uint8List

The bytes comprising the body of this response.

read-only
contentLength int

The size of the response body, in bytes.

read-only, inherited
hashCode int

Get a hash code for this object.

read-only, inherited
headers Map<String, String>

The headers for this response.

read-only, inherited
isRedirect bool

Whether this response is a redirect.

read-only, inherited
persistentConnection bool

Whether the server requested that a persistent connection be maintained.

read-only, inherited
reasonPhrase String

The reason phrase associated with the status code.

read-only, inherited
request BaseRequest

The (frozen) request that triggered this response.

read-only, inherited
runtimeType Type

A representation of the runtime type of the object.

read-only, inherited
statusCode int

The status code of the response.

read-only, inherited

Operators

operator ==(other) bool

The equality operator.

inherited

Methods

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
toString() String

Returns a string representation of this object.

inherited