diff --git a/CHANGELOG.md b/CHANGELOG.md index 78e6df1..c840228 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.6.1 - 2018-07-13 + +* More fixes to update to Dart 2 core library APIs. + ## 0.6.0+1 - 2018-07-13 * Updated implementation to use new Dart 2 APIs using diff --git a/analysis_options.yaml b/analysis_options.yaml index 4c5d70c..b2d4046 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,8 +1,3 @@ -analyzer: - strong-mode: true -# exclude: -# - path/to/excluded/files/** - # Lint rules and documentation, see http://dart-lang.github.io/linter/lints linter: rules: diff --git a/example/route_guide/lib/src/common.dart b/example/route_guide/lib/src/common.dart index f8e5500..f7b2992 100644 --- a/example/route_guide/lib/src/common.dart +++ b/example/route_guide/lib/src/common.dart @@ -24,7 +24,7 @@ final List featuresDb = _readDatabase(); List _readDatabase() { final dbData = new File('data/route_guide_db.json').readAsStringSync(); - final List db = JSON.decode(dbData); + final List db = jsonDecode(dbData); return db.map((entry) { final location = new Point() ..latitude = entry['location']['latitude'] diff --git a/example/route_guide/lib/src/server.dart b/example/route_guide/lib/src/server.dart index ba0354c..f964b8d 100644 --- a/example/route_guide/lib/src/server.dart +++ b/example/route_guide/lib/src/server.dart @@ -14,7 +14,7 @@ // limitations under the License. import 'dart:async'; -import 'dart:math' show PI, atan2, cos, max, min, sin, sqrt; +import 'dart:math' show atan2, cos, max, min, pi, sin, sqrt; import 'package:grpc/grpc.dart' as grpc; @@ -120,7 +120,7 @@ class RouteGuideService extends RouteGuideServiceBase { /// This code was taken from http://www.movable-type.co.uk/scripts/latlong.html. double _distance(Point start, Point end) { double toRadians(double num) { - return num * PI / 180; + return num * pi / 180; } final lat1 = start.latitude / coordFactor; diff --git a/interop/bin/server.dart b/interop/bin/server.dart index f26f6be..cf77d88 100644 --- a/interop/bin/server.dart +++ b/interop/bin/server.dart @@ -61,7 +61,7 @@ class TestService extends TestServiceBase { Future cacheableUnaryCall( ServiceCall call, SimpleRequest request) async { final timestamp = new DateTime.now().microsecond * 1000; - final responsePayload = new Payload()..body = ASCII.encode('$timestamp'); + final responsePayload = new Payload()..body = ascii.encode('$timestamp'); return new SimpleResponse()..payload = responsePayload; } diff --git a/lib/src/shared/timeout.dart b/lib/src/shared/timeout.dart index 4ce6f16..965ab88 100644 --- a/lib/src/shared/timeout.dart +++ b/lib/src/shared/timeout.dart @@ -41,8 +41,7 @@ String toTimeoutString(Duration duration) { Duration fromTimeoutString(String timeout) { if (timeout == null) return null; if (timeout.length < 2) return null; - final value = - int.parse(timeout.substring(0, timeout.length - 1), onError: (_) => null); + final value = int.tryParse(timeout.substring(0, timeout.length - 1)); if (value == null) return null; switch (timeout[timeout.length - 1]) { case 'n': diff --git a/pubspec.yaml b/pubspec.yaml index 7e4e471..bd766fb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: grpc description: Dart implementation of gRPC. -version: 0.6.0+1 +version: 0.6.1 author: Dart Team homepage: https://github.com/dart-lang/grpc-dart diff --git a/test/options_test.dart b/test/options_test.dart index 484e407..0b90958 100644 --- a/test/options_test.dart +++ b/test/options_test.dart @@ -18,7 +18,7 @@ import 'dart:io'; import 'package:grpc/grpc.dart'; import 'package:test/test.dart'; -const isTlsException = const isInstanceOf(); +const isTlsException = const TypeMatcher(); void main() { group('Certificates', () { diff --git a/test/src/utils.dart b/test/src/utils.dart index 699719b..1c249f4 100644 --- a/test/src/utils.dart +++ b/test/src/utils.dart @@ -27,7 +27,7 @@ int mockDecode(List value) => value.length; Map headersToMap(List
headers) => new Map.fromIterable(headers, - key: (h) => ASCII.decode(h.name), value: (h) => ASCII.decode(h.value)); + key: (h) => ascii.decode(h.name), value: (h) => ascii.decode(h.value)); void validateRequestHeaders(List
headers, {String path, @@ -80,20 +80,20 @@ void validateResponseTrailers(Map trailers, GrpcMetadata validateMetadataMessage(StreamMessage message, {bool endStream = false}) { - expect(message, new isInstanceOf()); + expect(message, new TypeMatcher()); expect(message.endStream, endStream); final decoded = new GrpcHttpDecoder().convert(message); - expect(decoded, new isInstanceOf()); + expect(decoded, new TypeMatcher()); return decoded; } GrpcData validateDataMessage(StreamMessage message, {bool endStream = false}) { - expect(message, new isInstanceOf()); + expect(message, new TypeMatcher()); expect(message.endStream, endStream); final decoded = new GrpcHttpDecoder().convert(message); - expect(decoded, new isInstanceOf()); + expect(decoded, new TypeMatcher()); return decoded; } diff --git a/test/stream_test.dart b/test/stream_test.dart index bc0e468..73c1a0f 100644 --- a/test/stream_test.dart +++ b/test/stream_test.dart @@ -50,7 +50,7 @@ void main() { expect(message.data, expected); } - expect(converted[0], new isInstanceOf()); + expect(converted[0], new TypeMatcher()); verify(converted[1], [48, 49, 50, 51, 52, 53, 54, 55, 56, 57]); verify(converted[2], [97, 98, 99, 100]); verify(converted[3], [65]); @@ -132,11 +132,11 @@ void main() { ..close(); final converted = await result; expect(converted.length, 3); - expect(converted[0], new isInstanceOf()); - expect(converted[1], new isInstanceOf()); + expect(converted[0], new TypeMatcher()); + expect(converted[1], new TypeMatcher()); var data = converted[1] as GrpcData; expect(data.data.length, 2); - expect(converted[2], new isInstanceOf()); + expect(converted[2], new TypeMatcher()); data = converted[2] as GrpcData; expect(data.data.length, 0); });