diff --git a/lib/angel_client.dart b/lib/angel_client.dart index e6bde541..5e5f255c 100644 --- a/lib/angel_client.dart +++ b/lib/angel_client.dart @@ -44,7 +44,7 @@ abstract class Angel { /// Logs the current user out of the application. Future logout(); - Service service(String path, {Type type, AngelDeserializer deserializer}); + Service service(String path, {Type type, AngelDeserializer deserializer}); Future delete(String url, {Map headers}); @@ -90,24 +90,24 @@ class AngelAuthResult { } /// Queries a service on an Angel server, with the same API. -abstract class Service { +abstract class Service { /// Fired on `indexed` events. - Stream get onIndexed; + Stream get onIndexed; /// Fired on `read` events. - Stream get onRead; + Stream get onRead; /// Fired on `created` events. - Stream get onCreated; + Stream get onCreated; /// Fired on `modified` events. - Stream get onModified; + Stream get onModified; /// Fired on `updated` events. - Stream get onUpdated; + Stream get onUpdated; /// Fired on `removed` events. - Stream get onRemoved; + Stream get onRemoved; /// The Angel instance powering this service. Angel get app; diff --git a/lib/base_angel_client.dart b/lib/base_angel_client.dart index 8f9884da..6e97a426 100644 --- a/lib/base_angel_client.dart +++ b/lib/base_angel_client.dart @@ -191,10 +191,10 @@ abstract class BaseAngelClient extends Angel { } @override - Service service(String path, + Service service(String path, {Type type, AngelDeserializer deserializer}) { String uri = path.toString().replaceAll(straySlashes, ""); - var s = new BaseAngelService(client, this, '$basePath/$uri', + var s = new BaseAngelService(client, this, '$basePath/$uri', deserializer: deserializer); _services.add(s); return s; @@ -241,37 +241,37 @@ abstract class BaseAngelClient extends Angel { } } -class BaseAngelService extends Service { +class BaseAngelService extends Service { @override final BaseAngelClient app; final String basePath; final http.BaseClient client; final AngelDeserializer deserializer; - final StreamController _onIndexed = new StreamController(), - _onRead = new StreamController(), - _onCreated = new StreamController(), - _onModified = new StreamController(), - _onUpdated = new StreamController(), - _onRemoved = new StreamController(); + final StreamController _onIndexed = new StreamController(), + _onRead = new StreamController(), + _onCreated = new StreamController(), + _onModified = new StreamController(), + _onUpdated = new StreamController(), + _onRemoved = new StreamController(); @override - Stream get onIndexed => _onIndexed.stream; + Stream get onIndexed => _onIndexed.stream; @override - Stream get onRead => _onRead.stream; + Stream get onRead => _onRead.stream; @override - Stream get onCreated => _onCreated.stream; + Stream get onCreated => _onCreated.stream; @override - Stream get onModified => _onModified.stream; + Stream get onModified => _onModified.stream; @override - Stream get onUpdated => _onUpdated.stream; + Stream get onUpdated => _onUpdated.stream; @override - Stream get onRemoved => _onRemoved.stream; + Stream get onRemoved => _onRemoved.stream; @override Future close() async { diff --git a/lib/io.dart b/lib/io.dart index 1d450681..e1a34cf7 100644 --- a/lib/io.dart +++ b/lib/io.dart @@ -15,10 +15,10 @@ class Rest extends BaseAngelClient { Rest(String path) : super(new http.Client(), path); @override - Service service(String path, {Type type, AngelDeserializer deserializer}) { + Service service(String path, {Type type, AngelDeserializer deserializer}) { String uri = path.replaceAll(straySlashes, ""); - var s = new RestService( - client, this, "$basePath/$uri", T != dynamic ? T : type); + var s = new RestService( + client, this, "$basePath/$uri", type); _services.add(s); return s; } @@ -37,7 +37,7 @@ class Rest extends BaseAngelClient { } /// Queries an Angel service via REST. -class RestService extends BaseAngelService { +class RestService extends BaseAngelService { final Type type; RestService(http.BaseClient client, Angel app, String url, this.type)