SmartInitializingSingleton class abstract interface

Callback interface triggered at the end of the singleton pre-instantiation phase.

Implement this interface if your singleton pod needs to react once all other singleton pods have been created and initialized by the container.

This is useful for pods that depend on the full initialization of the context, such as event broadcasters, context validators, or components that aggregate other singleton pods.

Unlike InitializingPod or @PostConstruct, which run per pod, this hook runs once globally, after all singletons are ready.

Example

class StartupLogger implements SmartInitializingSingleton {
  @override
  void onSingletonReady() {
    print('All singletons are initialized!');
  }
}

The framework will call this after refreshing the context, once the entire singleton graph has been created.

Implemented types
Implementers

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

getPackageName() → String
Represents an abstraction for identifying the package that an object, resource, or service belongs to.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onSingletonReady() → Future<void>
Callback interface triggered at the end of the singleton pre-instantiation phase.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited