AsyncServiceAccessException class final
An exception thrown when an attempt is made to access an asynchronous service using a synchronous method.
This exception helps identify incorrect usage of asynchronous services, guiding developers to use the appropriate asynchronous methods for accessing such services.
Usage: Throws when trying to access an asynchronous service synchronously.
T getInstance() {
if (_resolvedInstance == null) {
throw AsyncServiceAccessException(T);
}
return _resolvedInstance!;
}
- Implemented types
Constructors
- AsyncServiceAccessException.new(Type serviceType, [String? serviceName])
-
Constructs an AsyncServiceAccessException with the
serviceType
that was accessed synchronously.const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- serviceName → String?
-
The name of the asynchronous service that was accessed incorrectly, if any.
final
- serviceType → Type
-
The type of the asynchronous service that was accessed incorrectly.
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