register<T> method
void
register<T>(
- FactoryDelegate<
T> factory, { - String name = '',
- Lifestyle lifestyle = Lifestyle.Singleton,
Register a component of specified type using factory delegate.
Implementation
void register<T>(FactoryDelegate<T> factory, {String name = '', Lifestyle lifestyle = Lifestyle.Singleton}) {
final component = _Handler._(factory, T, name, lifestyle);
var handler = _handlers[component._type];
if (handler == null) {
handler = _HandlerCollection._(component._type, this);
_handlers[component._type] = handler;
}
handler.add(component);
}