originalException property

DioException? originalException
final

The underlying Dio exception that caused this network error.

Contains detailed information about the HTTP request failure, including:

  • HTTP status code and response data
  • Request details (URL, headers, body)
  • Error type (timeout, connection, response, etc.)

Returns null if the network exception was created without an underlying Dio error, such as for manually detected validation failures.

Example:

if (exception.originalException?.type == DioExceptionType.connectionTimeout) {
  showMessage('Connection timeout. Please check your internet.');
}

Implementation

final DioException? originalException;