injectFromParent<T> method
Injects and returns an object representing token from the parent.
Unlike inject, this only checks instances registered directly with the
parent injector, not this injector, or further ancestors. This is
equivalent to constructor parameters annotated with @Host.
Throws an error if token was not found.
Implementation
@protected
@nonVirtual
T injectFromParent<T>(Object token) {
final result = injectFromParentOptional(token);
if (identical(result, throwIfNotFound)) {
throw errors.noProviderError(token);
}
return unsafeCast(result);
}