registerFactory<T, R extends T> method
Register a factory that creates a new instance on each resolution.
This registration only applies to this container and its children.
Type Parameters:
T: The interface or base type to registerR: The concrete implementation (must extend or implementT)
Parameters:
locator: Factory function that creates instancesname: Optional name qualifier for named instances
Implementation
void registerFactory<T, R extends T>(SpotGetter<R> locator, {String? name}) {
final key = SpotKey<T>(T, name);
if (registry.containsKey(key) && logging) {
log.w('Overriding factory in scope: $key with $R');
}
registry[key] = SpotService<T>(SpotType.factory, locator as SpotGetter<T>, R);
if (logging) log.v('Registered factory in scope: $key -> $R');
}