get<T extends Object> method
- Object? token
Retrieves a dependency of type T.
token: An optional token (e.g., InjectorToken) or Type to disambiguate between different implementations of the same type.
Throws an InjectorError if the dependency was not requested or cannot be found.
Implementation
T get<T extends Object>([Object? token]) {
var service = getOptional<T>(token);
if (service != null) return service;
throw InjectorError("Requested Type or InjectorToken is null: ${_getTokenRepresentation(token)}");
}