get<T> method
T
get<T>()
Get an instance of the service by type
Implementation
T get<T>() => singletons.containsKey(T)
? singletons[T] as T
: serviceDefinitionsByType.containsKey(T)
? (serviceDefinitionsByType[T]!.isSingleton
? singletons.putIfAbsent(
T,
() => serviceDefinitionsByType[T]!.factory(this) as Object,
) as T
: serviceDefinitionsByType[T]!.factory(this) as T)
: throw ServiceNotFoundException<T>(
'Service ${(T).toString()} not found',
);