Response class

An HTTP response. Content of and meta data about a response to an HTTP request. All meta data (headers, status, statusText) and the response body are available immediately and synchronously.

The response body may be accessed in three different formats:

  • bytes (Uint8List)
  • text (String)
  • JSON (Map or List) - assuming the response content type is JSON
Inheritance
Implementers

Constructors

Response.fromBytes(int status, String statusText, Map<String, String> headers, List<int> bytes)
Response.fromString(int status, String statusText, Map<String, String> headers, String? bodyString)

Properties

body HttpBody
This response's body. Provides synchronous access to the response body as bytes, text, or JSON.
no setter
contentLength int
Gets and sets the content-length of the request, in bytes. If the size of the request is not known in advance, set this to null.
no setteroverride
contentType MediaType?
Content-type of this request.
no setterinherited
encoding Encoding?
Encoding that will be used to decode the response body. This encoding is selected based on contentType's charset parameter. If charset is not given or the encoding name is unrecognized, latin1 is used by default (RFC 2616).
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
Headers sent with the response to the HTTP request.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status int
Status code of the response to the HTTP request. 200, 404, etc.
finalinherited
statusText String
Status text of the response to the HTTP request. 'OK', 'Not Found', etc.
finalinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
replace({List<int>? bodyBytes, String? bodyString, int? status, String? statusText, Map<String, String>? headers}) Response
Create a new Response using all the values from this instance except for the parameters specified.
toString() String
A string representation of this object.
inherited

Operators

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