StateException class

Exception for state-related errors.

Use this for invalid state transitions or state access errors.

if (bloc.isClosed) {
  throw StateException('Cannot send events to a closed bloc');
}
Inheritance

Constructors

StateException(String message, {Object? cause, StackTrace? stackTrace})
Creates a StateException.
const

Properties

cause Object?
The underlying error that caused this exception, if any.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
isNetworkError bool
Whether this is a network-related error.
no setterinherited
isRetryable bool
State errors are generally not retryable.
no setteroverride
isTimeoutError bool
Whether this is a timeout error.
no setterinherited
isValidationError bool
Whether this is a validation error.
no setterinherited
message String
Human-readable error message.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stackTrace StackTrace?
The stack trace where this exception occurred.
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