ApiResponse<BodyType, InnerType> class

Constructors

ApiResponse({dynamic bodyString, Pagination? pagination, int statusCode = 500, Map<String, dynamic>? headers, BodyType? body, Object? error, Map<String, dynamic>? extra, Object? cause, StackTrace? stackTrace, required ApiRequest<BodyType, InnerType> request})

Properties

body → BodyType?
final
bodyString → dynamic
final
cause → Object?
The original throwable behind error, when this response was produced by an exception rather than an HTTP status.
final
error → Object?
Body of response if isSuccessful is false
final
extra → Map<String, dynamic>?
final
hashCode → int
The hash code for this object.
no setterinherited
headers → Map<String, dynamic>?
final
isCancelled → bool
True when this response is the result of a cancellation rather than a failure worth reporting to the user.
no setter
isSuccessful → bool
true if the status code is >= 200 && < 300 and nothing set an error.
no setter
pagination → Pagination?
final
request → ApiRequest<BodyType, InnerType>
final
resolve → Future<ApiResponse<BodyType, InnerType>>
Runs the request's interceptors over this response.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stackTrace → StackTrace?
Stack trace captured where cause was thrown, when available.
final
statusCode → int
final

Methods

copyWith({int? statusCode, Object? error = _unset, Map<String, dynamic>? headers, dynamic bodyString = _unset, Object? body = _unset, Object? pagination = _unset, Map<String, dynamic>? extra, Object? cause = _unset, StackTrace? stackTrace, ApiRequest<BodyType, InnerType>? request}) → ApiResponse<BodyType, InnerType>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

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

Constants

cacheHit → const int
Status code used when a response is served from the local cache.
cancelled → const int
Status code used when the call was cancelled via its CancellationToken.
transportFailure → const int
Status code used when the request never produced an HTTP response at all (transport failure, or an interceptor threw during onRequest).