From 3a9bd27d6def1833cc3093b08441dd6e7bcd09d0 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 17 Apr 2019 15:34:30 -0400 Subject: [PATCH] fix async resolutions --- lib/src/core/injection.dart | 7 ++++--- pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/src/core/injection.dart b/lib/src/core/injection.dart index 9eb26d66..2e7ed073 100644 --- a/lib/src/core/injection.dart +++ b/lib/src/core/injection.dart @@ -68,12 +68,13 @@ resolveInjection(requirement, InjectionRequest injection, RequestContext req, } else if (requirement is Type && requirement != dynamic) { try { var futureType = container.reflector.reflectFutureOf(requirement); - return await container.make(futureType.reflectedType); + if (container.has(futureType.reflectedType)) + return await container.make(futureType.reflectedType); } 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) { throw new ArgumentError( '$requirement cannot be injected into a request handler.'); diff --git a/pubspec.yaml b/pubspec.yaml index e092d03b..3ad3dc10 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,7 +6,7 @@ homepage: https://github.com/angel-dart/angel_framework environment: sdk: ">=2.0.0-dev <3.0.0" dependencies: - angel_container: ^1.0.0-alpha + angel_container: ^1.0.4 angel_http_exception: ^1.0.0 angel_model: ^1.0.0 angel_route: ^3.0.0