addSingletonCallback abstract method
Add a callback to be executed when the singleton associated with name
is initialized.
This method allows registering callbacks that will be executed when a singleton is initialized. The callback will receive the singleton instance as its parameter.
name
: The name of the singleton to register the callback for
callback
: The callback to execute when the singleton is initialized
Throws:
IllegalArgumentException
if name is null or emptyPodNotFoundException
if no singleton exists with the given name
Example:
singletonRegistry.addSingletonCallback('userService', (userService) {
print('UserService initialized: $userService');
});
Implementation
void addSingletonCallback(String name, Class type, Consumer<Object> callback);