Update to latest lints, required Dart 3.7 (#55)
- updated code formatting
diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml
index 2ae7f9d..ccede6a 100644
--- a/.github/workflows/publish.yaml
+++ b/.github/workflows/publish.yaml
@@ -12,3 +12,6 @@
publish:
if: ${{ github.repository_owner == 'google' }}
uses: dart-lang/ecosystem/.github/workflows/publish.yaml@main
+ permissions:
+ id-token: write # Required for authentication using OIDC
+ pull-requests: write # Required for writing the pull request note
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml
index 5aeeef7..f45672e 100644
--- a/.github/workflows/test-package.yml
+++ b/.github/workflows/test-package.yml
@@ -47,7 +47,7 @@
matrix:
# Add macos-latest and/or windows-latest if relevant for this package.
os: [ubuntu-latest]
- sdk: [3.0, dev]
+ sdk: [3.7, dev]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ede4568..ebeb890 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,6 @@
## 0.3.2-wip
-* Require Dart 3.0
+* Require Dart 3.7
## 0.3.1
diff --git a/lib/src/sync_http.dart b/lib/src/sync_http.dart
index e28839f..43abbd0 100644
--- a/lib/src/sync_http.dart
+++ b/lib/src/sync_http.dart
@@ -63,8 +63,8 @@
final RawSynchronousSocket _socket;
SyncHttpClientRequest._(this.method, this.uri, bool body)
- : _body = body ? BytesBuilder() : null,
- _socket = RawSynchronousSocket.connectSync(uri.host, uri.port);
+ : _body = body ? BytesBuilder() : null,
+ _socket = RawSynchronousSocket.connectSync(uri.host, uri.port);
/// Write content into the body of the HTTP request.
void write(Object? obj) {
@@ -259,7 +259,7 @@
HttpHeaders.connectionHeader,
HttpHeaders.contentLengthHeader,
HttpHeaders.contentTypeHeader,
- HttpHeaders.hostHeader
+ HttpHeaders.hostHeader,
].forEach(forEachFunc);
_headers.keys.forEach(forEachFunc);
}
@@ -401,7 +401,8 @@
headers[name]!.add(value);
} else if (line.startsWith('HTTP/1.1') || line.startsWith('HTTP/1.0')) {
statusCode = int.parse(
- line.substring('HTTP/1.x '.length, 'HTTP/1.x xxx'.length));
+ line.substring('HTTP/1.x '.length, 'HTTP/1.x xxx'.length),
+ );
reasonPhrase = line.substring('HTTP/1.x xxx '.length);
inHeader = true;
} else {
@@ -430,15 +431,20 @@
}
}
- return SyncHttpClientResponse._(headers,
- reasonPhrase: reasonPhrase,
- statusCode: statusCode,
- body: body.toString());
+ return SyncHttpClientResponse._(
+ headers,
+ reasonPhrase: reasonPhrase,
+ statusCode: statusCode,
+ body: body.toString(),
+ );
}
- SyncHttpClientResponse._(Map<String, List<String>> headers,
- {this.reasonPhrase, this.statusCode, this.body})
- : headers = _SyncHttpClientResponseHeaders(headers);
+ SyncHttpClientResponse._(
+ Map<String, List<String>> headers, {
+ this.reasonPhrase,
+ this.statusCode,
+ this.body,
+ }) : headers = _SyncHttpClientResponseHeaders(headers);
}
class _SyncHttpClientResponseHeaders implements HttpHeaders {
diff --git a/pubspec.yaml b/pubspec.yaml
index 795ab17..503fe9a 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -4,8 +4,8 @@
repository: https://github.com/google/sync_http.dart
environment:
- sdk: ^3.0.0
+ sdk: ^3.7.0
dev_dependencies:
- dart_flutter_team_lints: ^2.0.0
- test: ^1.16.0
+ dart_flutter_team_lints: ^3.0.0
+ test: ^1.16.6
diff --git a/test/http_basic_test.dart b/test/http_basic_test.dart
index 34d6468..08351f9 100644
--- a/test/http_basic_test.dart
+++ b/test/http_basic_test.dart
@@ -49,10 +49,7 @@
}
}
-enum TestServerCommandState {
- start,
- stop,
-}
+enum TestServerCommandState { start, stop }
class TestServerCommand {
TestServerCommand.start() : _command = TestServerCommandState.start;
@@ -66,11 +63,7 @@
final TestServerCommandState _command;
}
-enum TestServerStatusState {
- started,
- stopped,
- error,
-}
+enum TestServerStatusState { started, stopped, error }
class TestServerStatus {
TestServerStatus.started(this._port) : _state = TestServerStatusState.started;
@@ -226,8 +219,9 @@
final completer = Completer<void>();
final testServerMain = TestServerMain();
testServerMain.setServerStartedHandler((int? port) {
- final request =
- SyncHttpClient.getUrl(Uri.http('localhost:$port', '/0123456789'));
+ final request = SyncHttpClient.getUrl(
+ Uri.http('localhost:$port', '/0123456789'),
+ );
final response = request.close();
expect(HttpStatus.ok, equals(response.statusCode));
expect(11, equals(response.contentLength));
@@ -249,8 +243,9 @@
void runTest(int? port) {
var count = 0;
void sendRequest() {
- final request =
- SyncHttpClient.postUrl(Uri.http('localhost:$port', '/echo'));
+ final request = SyncHttpClient.postUrl(
+ Uri.http('localhost:$port', '/echo'),
+ );
request.write(data);
final response = request.close();
expect(HttpStatus.ok, equals(response.statusCode));
@@ -276,8 +271,9 @@
final completer = Completer<void>();
final testServerMain = TestServerMain();
testServerMain.setServerStartedHandler((int? port) {
- final request =
- SyncHttpClient.getUrl(Uri.http('localhost:$port', '/thisisnotfound'));
+ final request = SyncHttpClient.getUrl(
+ Uri.http('localhost:$port', '/thisisnotfound'),
+ );
final response = request.close();
expect(HttpStatus.notFound, equals(response.statusCode));
expect('Page not found', equals(response.body));
@@ -292,12 +288,15 @@
final completer = Completer<void>();
final testServerMain = TestServerMain();
testServerMain.setServerStartedHandler((int? port) {
- final request =
- SyncHttpClient.getUrl(Uri.http('localhost:$port', '/reasonformoving'));
+ final request = SyncHttpClient.getUrl(
+ Uri.http('localhost:$port', '/reasonformoving'),
+ );
final response = request.close();
expect(HttpStatus.movedPermanently, equals(response.statusCode));
expect(
- "Don't come looking here any more\r\n", equals(response.reasonPhrase));
+ "Don't come looking here any more\r\n",
+ equals(response.reasonPhrase),
+ );
testServerMain.close();
completer.complete();
});