ErrorHandler<E> class
Handles Dio exceptions and converts them to FailureResponse
Type Parameters: E - Custom error data type (optional)
Example:
try {
final response = await dio.get('/users');
} catch (error) {
final handler = ErrorHandler<LoginError>.handle(
error,
parseError: (json) => LoginError.fromJson(json),
);
print(handler.failure.message);
print(handler.failure.errorData?.email); // Type-safe!
}
- Implemented types
Constructors
-
ErrorHandler.handle(dynamic error, {E parseError(Map<
String, dynamic> )?})
Properties
-
failure
↔ FailureResponse<
E> -
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited