NetworkException class
Exception for network-related errors (connectivity, timeout).
This is the base class for all network exceptions. Use this to catch any network-related error, or catch specific subtypes for granular handling.
Example:
try {
await client.get('/users');
} on NetworkException catch (e) {
print('Network error: ${e.message}');
}
- Inheritance
-
- Object
- ApiException
- NetworkException
- Implementers
Constructors
- NetworkException({required String message, int? statusCode, Object? originalError, StackTrace? stackTrace})
-
Creates a NetworkException with the given
message.const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- message → String
-
Human-readable error message.
finalinherited
- originalError → Object?
-
The original error that caused this exception.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → StackTrace?
-
The stack trace from the original error.
finalinherited
- statusCode → int?
-
HTTP status code if available.
finalinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited