This commit is contained in:
Tobe O 2019-04-20 11:21:15 -04:00
parent 7ead5054d9
commit 6c9379698a
7 changed files with 22 additions and 18 deletions

View file

@ -1,3 +1,6 @@
# 2.0.2
* `_join` previously discarded quer parameters, etc.
# 2.0.1
* Change `BaseAngelClient` constructor to accept `dynamic` instead of `String` for `baseUrl.

View file

@ -2,5 +2,5 @@ include: package:pedantic/analysis_options.yaml
analyzer:
strong-mode:
implicit-casts: false
errors:
unawaited_futures: ignore
# errors:
# unawaited_futures: ignore

View file

@ -342,6 +342,6 @@ class ServiceList<Id, Data> extends DelegatingList<Data> {
Stream<ServiceList<Id, Data>> get onChange => _onChange.stream;
Future close() async {
_onChange.close();
await _onChange.close();
}
}

View file

@ -106,8 +106,8 @@ abstract class BaseAngelClient extends Angel {
Future<void> close() async {
client.close();
_onAuthenticated.close();
Future.wait(_services.map((s) => s.close())).then((_) {
await _onAuthenticated.close();
await Future.wait(_services.map((s) => s.close())).then((_) {
_services.clear();
});
}
@ -162,7 +162,7 @@ abstract class BaseAngelClient extends Angel {
Uri _join(url) {
var u = url is Uri ? url : Uri.parse(url.toString());
if (u.hasScheme || u.hasAuthority) return u;
return baseUrl.replace(path: p.join(baseUrl.path, u.path));
return u.replace(path: p.join(baseUrl.path, u.path));
}
@override
@ -233,12 +233,12 @@ class BaseAngelService<Id, Data> extends Service<Id, Data> {
@override
Future close() async {
_onIndexed.close();
_onRead.close();
_onCreated.close();
_onModified.close();
_onUpdated.close();
_onRemoved.close();
await _onIndexed.close();
await _onRead.close();
await _onCreated.close();
await _onModified.close();
await _onUpdated.close();
await _onRemoved.close();
}
BaseAngelService(this.client, this.app, baseUrl, {this.deserializer})

View file

@ -32,8 +32,8 @@ class Rest extends BaseAngelClient {
}
Future close() async {
super.close();
Future.wait(_services.map((s) => s.close())).then((_) {
await super.close();
await Future.wait(_services.map((s) => s.close())).then((_) {
_services.clear();
});
}

View file

@ -1,5 +1,5 @@
name: angel_client
version: 2.0.1
version: 2.0.2
description: Support for querying Angel servers in the browser, Flutter, and command-line.
author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/angel_client

View file

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:angel_client/io.dart' as c;
import 'package:angel_framework/angel_framework.dart' as s;
import 'package:angel_framework/http.dart' as s;
import 'package:pedantic/pedantic.dart';
import 'package:test/test.dart';
main() {
@ -31,7 +32,7 @@ main() {
});
test('listens on create', () async {
list.service.create({'foo': 'bar'});
unawaited(list.service.create({'foo': 'bar'}));
await list.onChange.first;
expect(list, [
{'foo': 'bar'}
@ -39,7 +40,7 @@ main() {
});
test('listens on modify', () async {
list.service.create({'id': 1, 'foo': 'bar'});
unawaited(list.service.create({'id': 1, 'foo': 'bar'}));
await queue.next;
await list.service.update(1, {'id': 1, 'bar': 'baz'});
@ -50,7 +51,7 @@ main() {
});
test('listens on remove', () async {
list.service.create({'id': '1', 'foo': 'bar'});
unawaited(list.service.create({'id': '1', 'foo': 'bar'}));
await queue.next;
await list.service.remove('1');