Fix HookedService type error

This commit is contained in:
Tobe O 2019-11-22 08:20:00 -05:00
parent 0f02f0bd70
commit f081a4a515
3 changed files with 10 additions and 6 deletions

View file

@ -1,3 +1,7 @@
# 2.0.5
* Fix a new (did not appear before 2.6/2.7) type error causing compilation to fail.
https://github.com/angel-dart/framework/issues/249
# 2.0.5-beta # 2.0.5-beta
* Make `@Expose()` in `Controller` optional. https://github.com/angel-dart/angel/issues/107 * Make `@Expose()` in `Controller` optional. https://github.com/angel-dart/angel/issues/107
* Add `allowHttp1` to `AngelHttp2` constructors. https://github.com/angel-dart/angel/issues/108 * Add `allowHttp1` to `AngelHttp2` constructors. https://github.com/angel-dart/angel/issues/108

View file

@ -95,12 +95,12 @@ class HookedService<Id, Data, T extends Service<Id, Data>>
/// Adds hooks to this instance. /// Adds hooks to this instance.
void addHooks(Angel app) { void addHooks(Angel app) {
Hooks hooks = getAnnotation<Hooks>(inner, app.container.reflector); var hooks = getAnnotation<Hooks>(inner, app.container.reflector);
List<HookedServiceEventListener<Id, Data, T>> before = [], after = []; List<HookedServiceEventListener<Id, Data, T>> before = [], after = [];
if (hooks != null) { if (hooks != null) {
before.addAll(hooks.before); before.addAll(hooks.before.cast());
after.addAll(hooks.after); after.addAll(hooks.after.cast());
} }
void applyListeners( void applyListeners(
@ -111,7 +111,7 @@ class HookedService<Id, Data, T extends Service<Id, Data>>
..addAll(isAfter == true ? after : before); ..addAll(isAfter == true ? after : before);
if (hooks != null) { if (hooks != null) {
listeners.addAll(isAfter == true ? hooks.after : hooks.before); listeners.addAll((isAfter == true ? hooks.after : hooks.before).cast());
} }
listeners.forEach(dispatcher.listen); listeners.forEach(dispatcher.listen);

View file

@ -10,7 +10,7 @@ import 'di_test.dart' as di;
import 'encoders_buffer_test.dart' as encoders_buffer; import 'encoders_buffer_test.dart' as encoders_buffer;
import 'env_test.dart' as env; import 'env_test.dart' as env;
import 'exception_test.dart' as exception; import 'exception_test.dart' as exception;
import 'extension_test.dart' as extension; import 'extension_test.dart' as extension_test;
import 'find_one_test.dart' as find_one; import 'find_one_test.dart' as find_one;
import 'general_test.dart' as general; import 'general_test.dart' as general;
import 'hooked_test.dart' as hooked; import 'hooked_test.dart' as hooked;
@ -42,7 +42,7 @@ main() {
group('encoders_buffer', encoders_buffer.main); group('encoders_buffer', encoders_buffer.main);
group('env', env.main); group('env', env.main);
group('exception', exception.main); group('exception', exception.main);
group('extension', extension.main); group('extension', extension_test.main);
group('find_one', find_one.main); group('find_one', find_one.main);
group('general', general.main); group('general', general.main);
group('hooked', hooked.main); group('hooked', hooked.main);