mirror of https://github.com/grpc/grpc-dart.git
Finish migrating to the Dart 2 core library constants. (#101)
This commit is contained in:
parent
c32a9e97be
commit
238fd7ec67
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -24,7 +24,7 @@ final List<Feature> featuresDb = _readDatabase();
|
|||
|
||||
List<Feature> _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']
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -61,7 +61,7 @@ class TestService extends TestServiceBase {
|
|||
Future<SimpleResponse> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: grpc
|
||||
description: Dart implementation of gRPC.
|
||||
version: 0.6.0+1
|
||||
version: 0.6.1
|
||||
author: Dart Team <misc@dartlang.org>
|
||||
homepage: https://github.com/dart-lang/grpc-dart
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import 'dart:io';
|
|||
import 'package:grpc/grpc.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
const isTlsException = const isInstanceOf<TlsException>();
|
||||
const isTlsException = const TypeMatcher<TlsException>();
|
||||
|
||||
void main() {
|
||||
group('Certificates', () {
|
||||
|
|
|
@ -27,7 +27,7 @@ int mockDecode(List<int> value) => value.length;
|
|||
|
||||
Map<String, String> headersToMap(List<Header> 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<Header> headers,
|
||||
{String path,
|
||||
|
@ -80,20 +80,20 @@ void validateResponseTrailers(Map<String, String> trailers,
|
|||
|
||||
GrpcMetadata validateMetadataMessage(StreamMessage message,
|
||||
{bool endStream = false}) {
|
||||
expect(message, new isInstanceOf<HeadersStreamMessage>());
|
||||
expect(message, new TypeMatcher<HeadersStreamMessage>());
|
||||
expect(message.endStream, endStream);
|
||||
|
||||
final decoded = new GrpcHttpDecoder().convert(message);
|
||||
expect(decoded, new isInstanceOf<GrpcMetadata>());
|
||||
expect(decoded, new TypeMatcher<GrpcMetadata>());
|
||||
return decoded;
|
||||
}
|
||||
|
||||
GrpcData validateDataMessage(StreamMessage message, {bool endStream = false}) {
|
||||
expect(message, new isInstanceOf<DataStreamMessage>());
|
||||
expect(message, new TypeMatcher<DataStreamMessage>());
|
||||
expect(message.endStream, endStream);
|
||||
|
||||
final decoded = new GrpcHttpDecoder().convert(message);
|
||||
expect(decoded, new isInstanceOf<GrpcData>());
|
||||
expect(decoded, new TypeMatcher<GrpcData>());
|
||||
return decoded;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ void main() {
|
|||
expect(message.data, expected);
|
||||
}
|
||||
|
||||
expect(converted[0], new isInstanceOf<GrpcMetadata>());
|
||||
expect(converted[0], new TypeMatcher<GrpcMetadata>());
|
||||
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<GrpcMetadata>());
|
||||
expect(converted[1], new isInstanceOf<GrpcData>());
|
||||
expect(converted[0], new TypeMatcher<GrpcMetadata>());
|
||||
expect(converted[1], new TypeMatcher<GrpcData>());
|
||||
var data = converted[1] as GrpcData;
|
||||
expect(data.data.length, 2);
|
||||
expect(converted[2], new isInstanceOf<GrpcData>());
|
||||
expect(converted[2], new TypeMatcher<GrpcData>());
|
||||
data = converted[2] as GrpcData;
|
||||
expect(data.data.length, 0);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue