fix async resolutions
This commit is contained in:
parent
ef8e343ccd
commit
3a9bd27d6d
2 changed files with 5 additions and 4 deletions
|
@ -68,12 +68,13 @@ resolveInjection(requirement, InjectionRequest injection, RequestContext req,
|
||||||
} else if (requirement is Type && requirement != dynamic) {
|
} else if (requirement is Type && requirement != dynamic) {
|
||||||
try {
|
try {
|
||||||
var futureType = container.reflector.reflectFutureOf(requirement);
|
var futureType = container.reflector.reflectFutureOf(requirement);
|
||||||
|
if (container.has(futureType.reflectedType))
|
||||||
return await container.make(futureType.reflectedType);
|
return await container.make(futureType.reflectedType);
|
||||||
} on UnsupportedError {
|
} on UnsupportedError {
|
||||||
// Ignore this; it just means that the reflector doesn't support futures.
|
// Ignore.
|
||||||
}
|
}
|
||||||
|
|
||||||
return container.make(requirement);
|
return await container.make(requirement);
|
||||||
} else if (throwOnUnresolved) {
|
} else if (throwOnUnresolved) {
|
||||||
throw new ArgumentError(
|
throw new ArgumentError(
|
||||||
'$requirement cannot be injected into a request handler.');
|
'$requirement cannot be injected into a request handler.');
|
||||||
|
|
|
@ -6,7 +6,7 @@ homepage: https://github.com/angel-dart/angel_framework
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.0.0-dev <3.0.0"
|
sdk: ">=2.0.0-dev <3.0.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
angel_container: ^1.0.0-alpha
|
angel_container: ^1.0.4
|
||||||
angel_http_exception: ^1.0.0
|
angel_http_exception: ^1.0.0
|
||||||
angel_model: ^1.0.0
|
angel_model: ^1.0.0
|
||||||
angel_route: ^3.0.0
|
angel_route: ^3.0.0
|
||||||
|
|
Loading…
Reference in a new issue