Skip to content

Commit f96db95

Browse files
authored
Latest lints, require Dart 3.0, use mini-libraries (#42)
1 parent d8e9f3d commit f96db95

8 files changed

+22
-50
lines changed

.github/workflows/test-package.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
matrix:
4848
# Add macos-latest and/or windows-latest if relevant for this package.
4949
os: [ubuntu-latest]
50-
sdk: [2.18.0, dev]
50+
sdk: [3.0, dev]
5151
steps:
5252
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
5353
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d

CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
## 0.3.2-dev
1+
## 0.3.2-wip
22

3-
* Require Dart 2.18
3+
* Require Dart 3.0
44

55
## 0.3.1
66

analysis_options.yaml

+2-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# https://dart.dev/guides/language/analysis-options
2-
include: package:lints/recommended.yaml
1+
# https://dart.dev/tools/analysis#the-analysis-options-file
2+
include: package:dart_flutter_team_lints/analysis_options.yaml
33

44
analyzer:
55
language:
@@ -9,47 +9,25 @@ analyzer:
99

1010
linter:
1111
rules:
12-
- always_declare_return_types
1312
- avoid_bool_literals_in_conditional_expressions
14-
- avoid_catching_errors
1513
- avoid_classes_with_only_static_members
16-
- avoid_dynamic_calls
1714
- avoid_private_typedef_functions
1815
- avoid_redundant_argument_values
19-
- avoid_returning_null_for_future
2016
- avoid_returning_this
2117
- avoid_unused_constructor_parameters
2218
- avoid_void_async
2319
- cancel_subscriptions
24-
- comment_references
25-
- directives_ordering
2620
- join_return_with_assignment
27-
- lines_longer_than_80_chars
2821
- literal_only_boolean_expressions
2922
- missing_whitespace_between_adjacent_strings
3023
- no_adjacent_strings_in_list
3124
- no_runtimeType_toString
32-
- omit_local_variable_types
33-
- only_throw_errors
3425
- package_api_docs
35-
- prefer_asserts_in_initializer_lists
36-
- prefer_const_constructors
3726
- prefer_const_declarations
3827
- prefer_expression_function_bodies
3928
- prefer_final_locals
40-
- prefer_relative_imports
41-
- prefer_single_quotes
42-
- sort_pub_dependencies
43-
- test_types_in_equals
44-
- throw_in_finally
45-
- type_annotate_public_apis
46-
- unawaited_futures
4729
- unnecessary_await_in_return
48-
- unnecessary_lambdas
49-
- unnecessary_parenthesis
5030
- unnecessary_raw_strings
51-
- unnecessary_statements
5231
- use_if_null_to_convert_nulls_to_bools
5332
- use_raw_strings
5433
- use_string_buffers
55-
- use_super_parameters

lib/src/line_decoder.dart

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
part of sync.http;
5+
import 'dart:convert';
6+
import 'dart:typed_data' show BytesBuilder;
67

78
// '\n' character
89
const int _lineTerminator = 10;
910

10-
class _LineDecoder {
11+
class LineDecoder {
1112
final BytesBuilder _unprocessedBytes = BytesBuilder();
1213

1314
int expectedByteCount = -1;
1415

15-
final void Function(String, int, _LineDecoder) _callback;
16+
final void Function(String, int, LineDecoder) _callback;
1617

17-
_LineDecoder.withCallback(this._callback);
18+
LineDecoder.withCallback(this._callback);
1819

1920
void add(List<int> chunk) {
2021
while (chunk.isNotEmpty) {

lib/src/sync_http.dart

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
part of sync.http;
5+
import 'dart:convert';
6+
import 'dart:io'
7+
show ContentType, HttpException, HttpHeaders, RawSynchronousSocket;
8+
import 'dart:typed_data' show BytesBuilder;
9+
10+
import 'line_decoder.dart';
611

712
// ignore: avoid_classes_with_only_static_members
813
/// A simple synchronous HTTP client.
@@ -368,7 +373,7 @@ class SyncHttpClientResponse {
368373
var contentLength = 0;
369374
var contentRead = 0;
370375

371-
void processLine(String line, int bytesRead, _LineDecoder decoder) {
376+
void processLine(String line, int bytesRead, LineDecoder decoder) {
372377
if (inBody) {
373378
body.write(line);
374379
contentRead += bytesRead;
@@ -404,7 +409,7 @@ class SyncHttpClientResponse {
404409
}
405410
}
406411

407-
final lineDecoder = _LineDecoder.withCallback(processLine);
412+
final lineDecoder = LineDecoder.withCallback(processLine);
408413

409414
try {
410415
while (!inHeader ||

lib/sync_http.dart

+1-9
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,4 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library sync.http;
6-
7-
import 'dart:convert';
8-
import 'dart:io'
9-
show ContentType, HttpException, HttpHeaders, RawSynchronousSocket;
10-
import 'dart:typed_data' show BytesBuilder;
11-
12-
part 'src/line_decoder.dart';
13-
part 'src/sync_http.dart';
5+
export 'src/sync_http.dart';

pubspec.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: sync_http
2-
version: 0.3.2-dev
2+
version: 0.3.2-wip
33
description: Synchronous HTTP client for Dart.
44
repository: https://github.com/google/sync_http.dart
55

66
environment:
7-
sdk: '>=2.18.0 <3.0.0'
7+
sdk: ^3.0.0
88

99
dev_dependencies:
10-
lints: ^2.0.0
10+
dart_flutter_team_lints: ^2.0.0
1111
test: ^1.16.0

test/http_basic_test.dart

-4
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ class TestServerStatus {
8181

8282
bool get isStarted => _state == TestServerStatusState.started;
8383

84-
bool get isStopped => _state == TestServerStatusState.stopped;
85-
86-
bool get isError => _state == TestServerStatusState.error;
87-
8884
int? get port => _port;
8985

9086
final TestServerStatusState _state;

0 commit comments

Comments
 (0)