Skip to content

Commit 1e42ffa

Browse files
authored
Enable strict language features (#653)
Migrate from `implicit-casts: false` to `strict-casts: true` and enable `string-raw-types` and `strict-inference`.
1 parent f35d1e1 commit 1e42ffa

File tree

6 files changed

+10
-8
lines changed

6 files changed

+10
-8
lines changed

analysis_options.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
include: package:lints/recommended.yaml
22

33
analyzer:
4-
strong-mode:
5-
implicit-casts: false
4+
language:
5+
strict-casts: true
6+
strict-raw-types: true
7+
strict-inference: true
68

79
linter:
810
rules:

lib/retry.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class RetryClient extends BaseClient {
119119
_unawaited(response.stream.listen((_) {}).cancel().catchError((_) {}));
120120
}
121121

122-
await Future.delayed(_delay(i));
122+
await Future<void>.delayed(_delay(i));
123123
_onRetry?.call(request, response, i);
124124
i++;
125125
}

lib/src/base_client.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ abstract class BaseClient implements Client {
7373
/// Sends a non-streaming [Request] and returns a non-streaming [Response].
7474
Future<Response> _sendUnstreamed(
7575
String method, Uri url, Map<String, String>? headers,
76-
[body, Encoding? encoding]) async {
76+
[Object? body, Encoding? encoding]) async {
7777
var request = Request(method, url);
7878

7979
if (headers != null) request.headers.addAll(headers);

lib/src/io_client.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class IOClient extends BaseClient {
4949
});
5050

5151
return IOStreamedResponse(
52-
response.handleError((error) {
52+
response.handleError((Object error) {
5353
final httpException = error as HttpException;
5454
throw ClientException(httpException.message, httpException.uri);
5555
}, test: (error) => error is HttpException),

test/multipart_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,6 @@ void main() {
244244
var file = http.MultipartFile(
245245
'file', Future<List<int>>.error('error').asStream(), 1);
246246
var request = http.MultipartRequest('POST', dummyUrl)..files.add(file);
247-
expect(request.finalize().drain(), throwsA('error'));
247+
expect(request.finalize().drain<void>(), throwsA('error'));
248248
});
249249
}

test/utils.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class _Parse extends Matcher {
4848
_Parse(this._matcher);
4949

5050
@override
51-
bool matches(Object? item, Map matchState) {
51+
bool matches(Object? item, Map<dynamic, dynamic> matchState) {
5252
if (item is String) {
5353
dynamic parsed;
5454
try {
@@ -80,7 +80,7 @@ class _BodyMatches extends Matcher {
8080
_BodyMatches(this._pattern);
8181

8282
@override
83-
bool matches(Object? item, Map matchState) {
83+
bool matches(Object? item, Map<dynamic, dynamic> matchState) {
8484
if (item is http.MultipartRequest) {
8585
return completes.matches(_checks(item), matchState);
8686
}

0 commit comments

Comments
 (0)