ApiException class

Custom API Exception Model Provides structured error information for all API failures

Implemented types

Constructors

ApiException({required String message, required ApiExceptionType type, int? statusCode, dynamic originalError, StackTrace? stackTrace, Map<String, dynamic>? errorData})
ApiException.custom({required String message, ApiExceptionType type = ApiExceptionType.unknown, int? statusCode, dynamic originalError, StackTrace? stackTrace, Map<String, dynamic>? errorData})
Create custom ApiException
factory
ApiException.fromDioException(DioException error)
Create ApiException from DioException
factory
ApiException.noInternet()
Create ApiException for no internet connection
factory

Properties

errorData Map<String, dynamic>?
final
hashCode int
The hash code for this object.
no setterinherited
isAuthError bool
Check if exception is due to authentication issues
no setter
isClientError bool
Check if exception is due to client error (4xx)
no setter
isNetworkError bool
Check if exception is due to network issues
no setter
isServerError bool
Check if exception is due to server error (5xx)
no setter
message String
final
originalError → dynamic
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stackTrace StackTrace?
final
statusCode int?
final
type ApiExceptionType
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDetailedString() String
Get detailed error information for debugging
toJson() Map<String, dynamic>
Convert to JSON format
toString() String
Convert to user-friendly string
override

Operators

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