DioResultsModel class

A model that represents all details of a Dio HTTP request and response.

Constructors

DioResultsModel({required int statusCode, required String statusMessage, required Map<String, dynamic> headers, required bool isRedirect, required List<RedirectRecord> redirects, required Map<String, dynamic> extra, required String requestPath, required String requestMethod, String? requestBaseUrl, dynamic requestData, Map<String, dynamic>? queryParameters, required Map<String, dynamic> requestHeaders, Duration? connectTimeout, Duration? receiveTimeout, String? contentType, DateTime? requestTime, DateTime? responseTime, Duration? duration, required Map<String, dynamic> rawResponse})
const
DioResultsModel.fromDioError(DioException dioError)
Creates an instance from a Dio Error (exception).
factory
DioResultsModel.fromDioResponse(Response dioResponse)
Creates an instance from a Dio Response.
factory

Properties

calculatedDuration Duration?
Calculates the duration between request and response.
no setter
connectTimeout Duration?
Timeout for establishing a connection.
final
contentType String?
The content type of the request.
final
duration Duration?
Duration between request and response.
final
errorType String
Returns a readable type for the kind of error.
no setter
extra Map<String, dynamic>
Extra metadata added to the response.
final
fullUrl String
Returns the complete request URL including query parameters.
no setter
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, dynamic>
The headers of the response.
final
isClientError bool
Checks if response indicates a client-side error (4xx).
no setter
isError bool
Checks if response status indicates error.
no setter
isJsonResponse bool
Checks if the response is JSON type.
no setter
isNetworkError bool
Checks if it's a network error (status code 0).
no setter
isRedirect bool
Whether the response is a redirect.
final
isServerError bool
Checks if response indicates a server-side error (5xx).
no setter
isSuccess bool
Checks if response status indicates success.
no setter
queryParameters Map<String, dynamic>?
Query parameters used in the request.
final
rawResponse Map<String, dynamic>
The actual response data.
final
receiveTimeout Duration?
Timeout for receiving the response.
final
redirects List<RedirectRecord>
A list of redirect records if redirects occurred.
final
requestBaseUrl String?
Base URL of the request.
final
requestData → dynamic
Body/data sent with the request.
final
requestHeaders Map<String, dynamic>
Headers sent with the request.
final
requestMethod String
HTTP method used for the request.
final
requestPath String
Path of the request.
final
requestTime DateTime?
Timestamp when the request started.
final
responseContentType String?
Returns the content-type of the response.
no setter
responseSize int?
Parses content length from headers, if available.
no setter
responseTime DateTime?
Timestamp when the response was received.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusCode int
The HTTP status code of the response.
final
statusMessage String
The HTTP status message of the response.
final

Methods

getHeader(String key) String?
Retrieves a value from response headers.
getRequestHeader(String key) String?
Retrieves a value from request headers.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDetailedMap() Map<String, dynamic>
Returns a detailed structured map of all request and response data.
toMap() Map<String, dynamic>
Returns a summarized map of key response and request data.
toString() String
Custom string output summarizing the response.
override

Operators

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