ServiceNotRegisteredException class final

An exception thrown when an attempt is made to access a service that has not been registered in the service locator.

This exception is used to signal that the requested service is not available in the service registry, helping to identify configuration errors or missing service registrations.

Usage: Throws when trying to retrieve a service that has not been registered.

T get<T extends Object>() {
  var service = _services[T];
  if (service == null) {
    throw ServiceNotRegisteredException(T);
  }
  return service as T;
}
Implemented types

Constructors

ServiceNotRegisteredException.new(Type serviceType, [String? serviceName])
Constructs a ServiceNotRegisteredException with the serviceType that was not found in the service registry.
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 service that was requested but not found, if any.
final
serviceType Type
The type of the service that was requested but not found in the registry.
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