Skip to content

Commit 1e80d0e

Browse files
committed
fix warnings
1 parent 05e9bed commit 1e80d0e

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/converters/duration_converter.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class DurationConverter implements IConverter
2020
var hasTime = t.length == 2;
2121
var d = splitOnFirst(t[0], 'D');
2222
if (d.length == 2) {
23-
var day = int.parse(d[0], onError: (s) => null);
23+
var day = int.tryParse(d[0]) ?? null;
2424
if (day != null) {
2525
days = day;
2626
}
@@ -29,23 +29,23 @@ class DurationConverter implements IConverter
2929
if (hasTime) {
3030
var h = splitOnFirst(t[1], 'H');
3131
if (h.length == 2) {
32-
var hour = int.parse(h[0], onError: (s) => null);
32+
var hour = int.tryParse(h[0]) ?? null;
3333
if (hour != null) {
3434
hours = hour;
3535
}
3636
}
3737

3838
var m = splitOnFirst(h[h.length - 1], 'M');
3939
if (m.length == 2) {
40-
var min = int.parse(m[0], onError: (s) => null);
40+
var min = int.tryParse(m[0]) ?? null;
4141
if (min != null) {
4242
minutes = min;
4343
}
4444
}
4545

4646
var s = splitOnFirst(m[m.length - 1], 'S');
4747
if (s.length == 2) {
48-
var millis = double.parse(s[0], (s) => null);
48+
var millis = double.tryParse(s[0]) ?? null;
4949
if (millis != null) {
5050
ms = millis;
5151
}

lib/json_service_client.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class JsonServiceClient implements IServiceClient {
7878
replyBaseUrl = combinePaths([baseUrl, "json", "reply"]) + "/";
7979
oneWayBaseUrl = combinePaths([baseUrl, "json", "oneway"]) + "/";
8080
headers = {
81-
HttpHeaders.ACCEPT: "application/json",
81+
HttpHeaders.acceptHeader: "application/json",
8282
};
8383
client = new HttpClient();
8484
cookies = new List<Cookie>();
@@ -363,16 +363,16 @@ class JsonServiceClient implements IServiceClient {
363363
var req = await client.openUrl(method, info.uri ?? createUri(url));
364364

365365
if (bearerToken != null)
366-
req.headers.add(HttpHeaders.AUTHORIZATION, 'Bearer ' + bearerToken);
366+
req.headers.add(HttpHeaders.authorizationHeader, 'Bearer ' + bearerToken);
367367
else if (userName != null)
368-
req.headers.add(HttpHeaders.AUTHORIZATION,
368+
req.headers.add(HttpHeaders.authorizationHeader,
369369
'Basic ' + base64.encode(utf8.encode('$userName:$password')));
370370

371371
req.cookies.addAll(this.cookies);
372372

373373
req.headers.chunkedTransferEncoding = false;
374374
headers.forEach((key, val) {
375-
if (key == HttpHeaders.CONTENT_TYPE) {
375+
if (key == HttpHeaders.contentTypeHeader) {
376376
var parts = val.split("/");
377377
req.headers.contentType = new ContentType(parts[0], parts[1]);
378378
} else {
@@ -381,7 +381,7 @@ class JsonServiceClient implements IServiceClient {
381381
});
382382

383383
if (bodyStr != null) {
384-
req.headers.contentType = ContentType.JSON;
384+
req.headers.contentType = ContentType.json;
385385
req.contentLength = bodyStr.length;
386386
}
387387

0 commit comments

Comments
 (0)