Skip to content

Commit 31f3d37

Browse files
authored
build: upgrades lint package (#172)
1 parent 2364df3 commit 31f3d37

27 files changed

+510
-585
lines changed

.github/actions/setup-flutter/action.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,17 @@ runs:
99
- name: 🐦 Setup Flutter
1010
uses: subosito/flutter-action@v2
1111
with:
12-
flutter-version: '3.22.2'
12+
flutter-version: '3.32.0'
1313
cache: true
1414

1515
- name: 📦 Get dependencies
1616
shell: bash
1717
run: flutter pub get
1818

19-
- name: ☕️ Set up JDK 17
19+
- name: ☕️ Set up JDK 21
2020
uses: actions/setup-java@v1
2121
with:
22-
java-version: '17'
23-
distribution: 'temurin'
22+
java-version: '21'
2423

2524
- name: 🔎 Check Flutter environment
2625
shell: bash

lib/extensions/base_request.dart

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -33,39 +33,38 @@ extension BaseRequestCopyWith on BaseRequest {
3333
List<MultipartFile>? files,
3434
// StreamedRequest only properties.
3535
Stream<List<int>>? stream,
36-
}) =>
37-
switch (this) {
38-
Request req => req.copyWith(
39-
method: method,
40-
url: url,
41-
headers: headers,
42-
body: body,
43-
encoding: encoding,
44-
followRedirects: followRedirects,
45-
maxRedirects: maxRedirects,
46-
persistentConnection: persistentConnection,
47-
),
48-
StreamedRequest req => req.copyWith(
49-
method: method,
50-
url: url,
51-
headers: headers,
52-
stream: stream,
53-
followRedirects: followRedirects,
54-
maxRedirects: maxRedirects,
55-
persistentConnection: persistentConnection,
56-
),
57-
MultipartRequest req => req.copyWith(
58-
method: method,
59-
url: url,
60-
headers: headers,
61-
fields: fields,
62-
files: files,
63-
followRedirects: followRedirects,
64-
maxRedirects: maxRedirects,
65-
persistentConnection: persistentConnection,
66-
),
67-
_ => throw UnsupportedError(
68-
'Cannot copy unsupported type of request $runtimeType',
69-
),
70-
};
36+
}) => switch (this) {
37+
Request req => req.copyWith(
38+
method: method,
39+
url: url,
40+
headers: headers,
41+
body: body,
42+
encoding: encoding,
43+
followRedirects: followRedirects,
44+
maxRedirects: maxRedirects,
45+
persistentConnection: persistentConnection,
46+
),
47+
StreamedRequest req => req.copyWith(
48+
method: method,
49+
url: url,
50+
headers: headers,
51+
stream: stream,
52+
followRedirects: followRedirects,
53+
maxRedirects: maxRedirects,
54+
persistentConnection: persistentConnection,
55+
),
56+
MultipartRequest req => req.copyWith(
57+
method: method,
58+
url: url,
59+
headers: headers,
60+
fields: fields,
61+
files: files,
62+
followRedirects: followRedirects,
63+
maxRedirects: maxRedirects,
64+
persistentConnection: persistentConnection,
65+
),
66+
_ => throw UnsupportedError(
67+
'Cannot copy unsupported type of request $runtimeType',
68+
),
69+
};
7170
}

lib/extensions/base_response_io.dart

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -32,40 +32,39 @@ extension BaseResponseCopyWith on BaseResponse {
3232
int? contentLength,
3333
// `IOStreamedResponse` only properties.
3434
HttpClientResponse? inner,
35-
}) =>
36-
switch (this) {
37-
Response res => res.copyWith(
38-
statusCode: statusCode,
39-
body: body,
40-
request: request,
41-
headers: headers,
42-
isRedirect: isRedirect,
43-
persistentConnection: persistentConnection,
44-
reasonPhrase: reasonPhrase,
45-
),
46-
IOStreamedResponse res => res.copyWith(
47-
stream: stream,
48-
statusCode: statusCode,
49-
contentLength: contentLength,
50-
request: request,
51-
headers: headers,
52-
isRedirect: isRedirect,
53-
persistentConnection: persistentConnection,
54-
reasonPhrase: reasonPhrase,
55-
inner: inner,
56-
),
57-
StreamedResponse res => res.copyWith(
58-
stream: stream,
59-
statusCode: statusCode,
60-
contentLength: contentLength,
61-
request: request,
62-
headers: headers,
63-
isRedirect: isRedirect,
64-
persistentConnection: persistentConnection,
65-
reasonPhrase: reasonPhrase,
66-
),
67-
_ => throw UnsupportedError(
68-
'Cannot copy unsupported type of response $runtimeType',
69-
),
70-
};
35+
}) => switch (this) {
36+
Response res => res.copyWith(
37+
statusCode: statusCode,
38+
body: body,
39+
request: request,
40+
headers: headers,
41+
isRedirect: isRedirect,
42+
persistentConnection: persistentConnection,
43+
reasonPhrase: reasonPhrase,
44+
),
45+
IOStreamedResponse res => res.copyWith(
46+
stream: stream,
47+
statusCode: statusCode,
48+
contentLength: contentLength,
49+
request: request,
50+
headers: headers,
51+
isRedirect: isRedirect,
52+
persistentConnection: persistentConnection,
53+
reasonPhrase: reasonPhrase,
54+
inner: inner,
55+
),
56+
StreamedResponse res => res.copyWith(
57+
stream: stream,
58+
statusCode: statusCode,
59+
contentLength: contentLength,
60+
request: request,
61+
headers: headers,
62+
isRedirect: isRedirect,
63+
persistentConnection: persistentConnection,
64+
reasonPhrase: reasonPhrase,
65+
),
66+
_ => throw UnsupportedError(
67+
'Cannot copy unsupported type of response $runtimeType',
68+
),
69+
};
7170
}

lib/extensions/base_response_none.dart

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,28 @@ extension BaseResponseCopyWith on BaseResponse {
2424
// `StreamedResponse` only properties.
2525
Stream<List<int>>? stream,
2626
int? contentLength,
27-
}) =>
28-
switch (this) {
29-
Response res => res.copyWith(
30-
statusCode: statusCode,
31-
body: body,
32-
request: request,
33-
headers: headers,
34-
isRedirect: isRedirect,
35-
persistentConnection: persistentConnection,
36-
reasonPhrase: reasonPhrase,
37-
),
38-
StreamedResponse res => res.copyWith(
39-
stream: stream,
40-
statusCode: statusCode,
41-
contentLength: contentLength,
42-
request: request,
43-
headers: headers,
44-
isRedirect: isRedirect,
45-
persistentConnection: persistentConnection,
46-
reasonPhrase: reasonPhrase,
47-
),
48-
_ => throw UnsupportedError(
49-
'Cannot copy unsupported type of response $runtimeType',
50-
),
51-
};
27+
}) => switch (this) {
28+
Response res => res.copyWith(
29+
statusCode: statusCode,
30+
body: body,
31+
request: request,
32+
headers: headers,
33+
isRedirect: isRedirect,
34+
persistentConnection: persistentConnection,
35+
reasonPhrase: reasonPhrase,
36+
),
37+
StreamedResponse res => res.copyWith(
38+
stream: stream,
39+
statusCode: statusCode,
40+
contentLength: contentLength,
41+
request: request,
42+
headers: headers,
43+
isRedirect: isRedirect,
44+
persistentConnection: persistentConnection,
45+
reasonPhrase: reasonPhrase,
46+
),
47+
_ => throw UnsupportedError(
48+
'Cannot copy unsupported type of response $runtimeType',
49+
),
50+
};
5251
}

lib/extensions/io_streamed_response.dart

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@ extension IOStreamedResponseCopyWith on IOStreamedResponse {
1414
bool? persistentConnection,
1515
String? reasonPhrase,
1616
HttpClientResponse? inner,
17-
}) =>
18-
IOStreamedResponse(
19-
stream ?? this.stream,
20-
statusCode ?? this.statusCode,
21-
contentLength: contentLength ?? this.contentLength,
22-
request: request ?? this.request,
23-
headers: headers ?? this.headers,
24-
isRedirect: isRedirect ?? this.isRedirect,
25-
persistentConnection: persistentConnection ?? this.persistentConnection,
26-
reasonPhrase: reasonPhrase ?? this.reasonPhrase,
27-
inner: inner,
28-
);
17+
}) => IOStreamedResponse(
18+
stream ?? this.stream,
19+
statusCode ?? this.statusCode,
20+
contentLength: contentLength ?? this.contentLength,
21+
request: request ?? this.request,
22+
headers: headers ?? this.headers,
23+
isRedirect: isRedirect ?? this.isRedirect,
24+
persistentConnection: persistentConnection ?? this.persistentConnection,
25+
reasonPhrase: reasonPhrase ?? this.reasonPhrase,
26+
inner: inner,
27+
);
2928
}

lib/extensions/multipart_request.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ extension MultipartRequestCopyWith on MultipartRequest {
2121
..fields.addAll(fields ?? this.fields);
2222

2323
for (final MultipartFile file in this.files) {
24-
clonedRequest.files.add(MultipartFile(
25-
file.field,
26-
file.finalize(),
27-
file.length,
28-
filename: file.filename,
29-
contentType: file.contentType,
30-
));
24+
clonedRequest.files.add(
25+
MultipartFile(
26+
file.field,
27+
file.finalize(),
28+
file.length,
29+
filename: file.filename,
30+
contentType: file.contentType,
31+
),
32+
);
3133
}
3234

3335
this.persistentConnection =

lib/extensions/response.dart

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ extension ResponseCopyWith on Response {
1212
bool? isRedirect,
1313
bool? persistentConnection,
1414
String? reasonPhrase,
15-
}) =>
16-
Response(
17-
body ?? this.body,
18-
statusCode ?? this.statusCode,
19-
request: request ?? this.request,
20-
headers: headers ?? this.headers,
21-
isRedirect: isRedirect ?? this.isRedirect,
22-
persistentConnection: persistentConnection ?? this.persistentConnection,
23-
reasonPhrase: reasonPhrase ?? this.reasonPhrase,
24-
);
15+
}) => Response(
16+
body ?? this.body,
17+
statusCode ?? this.statusCode,
18+
request: request ?? this.request,
19+
headers: headers ?? this.headers,
20+
isRedirect: isRedirect ?? this.isRedirect,
21+
persistentConnection: persistentConnection ?? this.persistentConnection,
22+
reasonPhrase: reasonPhrase ?? this.reasonPhrase,
23+
);
2524
}

lib/extensions/streamed_request.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ extension StreamedRequestCopyWith on StreamedRequest {
1515
bool? persistentConnection,
1616
}) {
1717
// Create a new StreamedRequest with the same method and URL
18-
final StreamedRequest clonedRequest =
19-
StreamedRequest(method?.asString ?? this.method, url ?? this.url)
20-
..headers.addAll(headers ?? this.headers);
18+
final StreamedRequest clonedRequest = StreamedRequest(
19+
method?.asString ?? this.method,
20+
url ?? this.url,
21+
)..headers.addAll(headers ?? this.headers);
2122

2223
// Use a broadcast stream to allow multiple listeners
2324
final Stream<List<int>> broadcastStream =

lib/extensions/streamed_response.dart

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ extension StreamedResponseCopyWith on StreamedResponse {
1313
bool? isRedirect,
1414
bool? persistentConnection,
1515
String? reasonPhrase,
16-
}) =>
17-
StreamedResponse(
18-
stream ?? this.stream,
19-
statusCode ?? this.statusCode,
20-
contentLength: contentLength ?? this.contentLength,
21-
request: request ?? this.request,
22-
headers: headers ?? this.headers,
23-
isRedirect: isRedirect ?? this.isRedirect,
24-
persistentConnection: persistentConnection ?? this.persistentConnection,
25-
reasonPhrase: reasonPhrase ?? this.reasonPhrase,
26-
);
16+
}) => StreamedResponse(
17+
stream ?? this.stream,
18+
statusCode ?? this.statusCode,
19+
contentLength: contentLength ?? this.contentLength,
20+
request: request ?? this.request,
21+
headers: headers ?? this.headers,
22+
isRedirect: isRedirect ?? this.isRedirect,
23+
persistentConnection: persistentConnection ?? this.persistentConnection,
24+
reasonPhrase: reasonPhrase ?? this.reasonPhrase,
25+
);
2726
}

lib/extensions/uri.dart

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,14 @@ extension AddParameters on Uri {
66
/// Returns a new [Uri] instance based on `this` and adds [parameters].
77
Uri addParameters([Map<String, dynamic>? parameters]) =>
88
parameters?.isNotEmpty ?? false
9-
? (StringBuffer()
10-
..writeAll([
11-
buildUrlString(
12-
"$origin$path",
13-
{
14-
...queryParametersAll,
15-
...?parameters,
16-
},
17-
),
18-
if (fragment.isNotEmpty) '#$fragment',
19-
]))
20-
.toString()
21-
.toUri()
22-
: this;
9+
? (StringBuffer()..writeAll([
10+
buildUrlString("$origin$path", {
11+
...queryParametersAll,
12+
...?parameters,
13+
}),
14+
if (fragment.isNotEmpty) '#$fragment',
15+
]))
16+
.toString()
17+
.toUri()
18+
: this;
2319
}

0 commit comments

Comments
 (0)