ProviderException class final
An exception thrown when trying to read a provider that is in error state.
This exception can be thrown when either:
- You're using a synchronous provider (Notifier/Provider) and the provider threw an exception during its initialization.
- You're using an asynchronous provider (FutureProvider/StreamProvider), the state is an AsyncError, and you called AsyncValue.requireValue.
- Using an asynchronous provider, you awaited FutureProvider.future, and the provider was in error state.
Catching this exception can be useful to differentiate between a provider in error state from a provider that depends on another provider in error state.
In particular, Riverpod will:
- Disable automatic retry if a ProviderException is thrown by a provider. This avoids retrying a provider that isn't the source of the problem.
- Not report the error to Zone if it is a ProviderException. This avoids reporting the same error twice.
- Implemented types
- Annotations
-
- @publicInMisc
Properties
- exception → Object
-
The exception that was thrown by the provider.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → StackTrace
-
The stack trace of the exception.
final
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