ApiResponse<T> class

Standardized response wrapper returned by every AutoPilot request.

Available extensions

Constructors

ApiResponse.failure({required String message, int statusCode = 0, dynamic raw, Map<String, dynamic>? errors, String? requestId, Duration? responseTime})
factory
ApiResponse.success({T? data, String message = 'Success', int statusCode = 200, dynamic raw, String? requestId, Duration? responseTime})
factory

Properties

allErrors String
no setter
allErrors String

Available on ApiResponse<T>, provided by the ApiResponseX extension

no setter
data → T?
final
dataOrThrow → T
no setter
dataOrThrow → T

Available on ApiResponse<T>, provided by the ApiResponseX extension

no setter
errors Map<String, dynamic>?
final
hashCode int
The hash code for this object.
no setterinherited
isClientError bool
no setter
isClientError bool

Available on ApiResponse<T>, provided by the ApiResponseX extension

no setter
isForbidden bool
no setter
isForbidden bool

Available on ApiResponse<T>, provided by the ApiResponseX extension

no setter
isNoInternet bool
no setter
isNotFound bool
no setter
isNotFound bool

Available on ApiResponse<T>, provided by the ApiResponseX extension

no setter
isServerError bool
no setter
isServerError bool

Available on ApiResponse<T>, provided by the ApiResponseX extension

no setter
isSuccess bool
final
isTimeout bool
no setter
isTimeout bool

Available on ApiResponse<T>, provided by the ApiResponseX extension

no setter
isUnauthorized bool
no setter
isUnauthorized bool

Available on ApiResponse<T>, provided by the ApiResponseX extension

no setter
isValidationError bool
no setter
isValidationError bool

Available on ApiResponse<T>, provided by the ApiResponseX extension

no setter
message String
final
raw → dynamic
final
requestId String?
final
responseTime Duration?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusCode int
final
timestamp DateTime
final

Methods

cast<R>(R? newData) ApiResponse<R>
Cast to different type
dataOr(T fallback) → T
dataOr(T fallback) → T

Available on ApiResponse<T>, provided by the ApiResponseX extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override
validationError(String field) String?
validationError(String field) String?

Available on ApiResponse<T>, provided by the ApiResponseX extension

Operators

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