NanoHttpResponse<T> class

A standardized generic response object for all HTTP requests.

Available extensions

Constructors

NanoHttpResponse({T? data, int? statusCode, String? statusMessage, Map<String, dynamic>? headers, NanoHttpRequest? request})
Creates a new NanoHttpResponse instance.
const

Properties

data → T?
The payload data returned by the server, parsed to type T.
final
hashCode → int
The hash code for this object.
no setterinherited
headers → Map<String, dynamic>?
The HTTP response headers.
final
isClientError → bool

Available on NanoHttpResponse, provided by the NanoHttpResponseExtension extension

Returns true if the status code is between 400 and 499 (inclusive).
no setter
isServerError → bool

Available on NanoHttpResponse, provided by the NanoHttpResponseExtension extension

Returns true if the status code is 500 or greater.
no setter
isSuccess → bool

Available on NanoHttpResponse, provided by the NanoHttpResponseExtension extension

Returns true if the status code is between 200 and 299 (inclusive).
no setter
request → NanoHttpRequest?
The original NanoHttpRequest associated with this response.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
statusCode → int?
The HTTP status code of the response (e.g., 200, 404).
final
statusMessage → String?
A descriptive message representing the status of the response.
final

Methods

copyWith({T? data, int? statusCode, String? statusMessage, Map<String, dynamic>? headers, NanoHttpRequest? request}) → NanoHttpResponse<T>
Creates a copy of this response with modified properties.
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