findServiceOf

This commit is contained in:
Tobe O 2018-11-07 21:53:07 -05:00
parent 10b6011aba
commit 681e2ac596
2 changed files with 7 additions and 1 deletions

View file

@ -2,6 +2,7 @@
* Add `readMany` to `Service`.
* Allow `ResponseContext.redirect` to take a `Uri`.
* Add `Angel.mountController`.
* Add `Angel.findServiceOf`.
# 2.0.0-alpha.10
* All calls to `Service.parseId` are now affixed with the `<Id>` argument.

View file

@ -81,7 +81,12 @@ class Routable extends Router<RequestHandler> {
}) as T;
}
/// Shorthand for finding a [HookedService] in a statically-typed
/// Shorthand for finding a [Service] in a statically-typed manner.
Service<Id, Data> findServiceOf<Id, Data>(Pattern path) {
return findService<Service<Id, Data>>(path);
}
/// Shorthand for finding a [HookedService] in a statically-typed manner.
HookedService<dynamic, dynamic, T> findHookedService<T extends Service>(
Pattern path) {
return findService(path) as HookedService<dynamic, dynamic, T>;