HttpResponse class

A neutral representation of an HTTP response.

Adapters convert their library-specific response objects (e.g. Dio's Response<T>) into this type. The rest of netanchor only sees HttpResponse.

Constructors

HttpResponse({required int statusCode, required Object? data, required Map<String, List<String>> headers, String? statusMessage})
Creates a response descriptor.

Properties

data Object?
Decoded payload. Usually a Map, List, String, or null.
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, List<String>>
Response headers with lower-case names and unmodifiable value lists.
final
isForbidden bool
Whether the response indicates a forbidden resource.
no setter
isServerError bool
Whether the status code is in the 5xx range.
no setter
isSuccess bool
Whether the status code is in the 2xx range.
no setter
isUnauthorized bool
Whether the response indicates an authentication failure.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusCode int
HTTP status code (e.g. 200, 404).
final
statusMessage String?
Optional reason phrase.
final

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