HttpResponse class

The response of a HttpRequest.

Inheritance
Implemented types

Constructors

HttpResponse(HttpMethod method, String url, String requestedURL, int status, HttpBody? body, {ResponseHeaderGetter? responseHeaderGetter, Object? request, List<Uri>? redirects, dynamic jsonDecoder(String jsonEncoded)?, HttpError? error})

Properties

accessTime int?
Last access time of this request. Used for caches timeout.
no setter
asJSONPaging JSONPaging?
Returns body as a JSONPaging.
no setter
body HttpBody?
Returns the response HttpBody.
no setter
bodyAsString String?
Returns the body as String.
no setter
bodyLength int?
Returns the body length (if present).
no setter
bodyMimeType MimeType?
Same as bodyType, but returns as MimeType.
no setter
bodyType String?
The body type (Content-Type).
no setter
error HttpError?
The response HttpError.
no setter
hasBody bool
Returns true if has body.
no setter
hashCode int
The hash code for this object.
no setterinherited
instanceDateTime DateTime
The instanceTime as DateTime.
no setter
instanceTime int
Time of instantiation.
final
isBodyTypeJSON bool
Returns true if bodyType is a JSON (application/json).
no setter
isError bool
Returns true if status represents any kind of error.
no setterinherited
isNotOK bool
Returns true if ![isOK]
no setterinherited
isOK bool
Returns true if is a successful status.
no setterinherited
isStatusAccessError bool
Returns true if is a Access Error status: 405..418 OR IN 400, 403, 431, 451.
no setterinherited
isStatusError bool
Returns true if any error happens: isStatusNetworkError || isStatusServerError || isStatusAccessError
no setterinherited
isStatusForbidden bool
Returns true if is 403 status (Forbidden).
no setterinherited
isStatusNetworkError bool
Returns true if any network error happens.
no setterinherited
isStatusNotFound bool
Returns true if is 404 status (Not Found).
no setterinherited
isStatusRedirect bool
Returns true if is 300-303 or 307-308 status (Redirect).
no setterinherited
isStatusServerError bool
Returns true if is a server error status: from range 500 to 599.
no setterinherited
isStatusSuccessful bool
Returns true if is a successful status: from range 200 to 299.
no setterinherited
isStatusUnauthenticated bool
Returns true if is 401 status (Unauthenticated).
no setterinherited
json → dynamic
Returns the body as JSON.
no setter
jsonDecoder ↔ dynamic Function(String jsonEncoded)?
The JSON decoder Function to use (optional).
getter/setter pair
method HttpMethod
Response Method
final
redirects List<Uri>
Returns the series of redirects this request has been through. The list will be empty if no redirects were followed.
final
redirectToLocation String?
Returns the redirect location header, the redirect that should be performed.
no setter
request Object?
Actual request of the client.
final
requestedURL String
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status int
finalinherited
url String
finalinherited

Methods

compareTo(HttpResponse other) int
Compares using instanceTime.
override
getResponseHeader(String headerKey) String?
Returns the header value for the parameter headerKey.
isStatus(int status) bool
Returns true if this status is equals parameter status.
inherited
isStatusInList(List<int> statusList) bool
Returns true if this status is in statusList.
inherited
isStatusInRange(int statusInit, int statusEnd) bool
Returns true if this status is in range of parameters statusInit and statusEnd.
inherited
memorySize() int
Tries to determine the memory usage of this response.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString([bool? withBody]) String
A string representation of this object.
override
updateAccessTime() → void

Operators

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