Latest lints, require Dart 3.0, use mini-libraries (#42)
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml
index 0352d7b..10f3ba1 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: [2.18.0, dev]
+ sdk: [3.0, dev]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 34d3359..ede4568 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,6 @@
-## 0.3.2-dev
+## 0.3.2-wip
-* Require Dart 2.18
+* Require Dart 3.0
## 0.3.1
diff --git a/analysis_options.yaml b/analysis_options.yaml
index b507c06..7c3ec7f 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,5 +1,5 @@
-# https://dart.dev/guides/language/analysis-options
-include: package:lints/recommended.yaml
+# https://dart.dev/tools/analysis#the-analysis-options-file
+include: package:dart_flutter_team_lints/analysis_options.yaml
analyzer:
language:
@@ -9,47 +9,25 @@
linter:
rules:
- - always_declare_return_types
- avoid_bool_literals_in_conditional_expressions
- - avoid_catching_errors
- avoid_classes_with_only_static_members
- - avoid_dynamic_calls
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- - avoid_returning_null_for_future
- avoid_returning_this
- avoid_unused_constructor_parameters
- avoid_void_async
- cancel_subscriptions
- - comment_references
- - directives_ordering
- join_return_with_assignment
- - lines_longer_than_80_chars
- literal_only_boolean_expressions
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_runtimeType_toString
- - omit_local_variable_types
- - only_throw_errors
- package_api_docs
- - prefer_asserts_in_initializer_lists
- - prefer_const_constructors
- prefer_const_declarations
- prefer_expression_function_bodies
- prefer_final_locals
- - prefer_relative_imports
- - prefer_single_quotes
- - sort_pub_dependencies
- - test_types_in_equals
- - throw_in_finally
- - type_annotate_public_apis
- - unawaited_futures
- unnecessary_await_in_return
- - unnecessary_lambdas
- - unnecessary_parenthesis
- unnecessary_raw_strings
- - unnecessary_statements
- use_if_null_to_convert_nulls_to_bools
- use_raw_strings
- use_string_buffers
- - use_super_parameters
diff --git a/lib/src/line_decoder.dart b/lib/src/line_decoder.dart
index b52e86a..54288a3 100644
--- a/lib/src/line_decoder.dart
+++ b/lib/src/line_decoder.dart
@@ -2,19 +2,20 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-part of sync.http;
+import 'dart:convert';
+import 'dart:typed_data' show BytesBuilder;
// '\n' character
const int _lineTerminator = 10;
-class _LineDecoder {
+class LineDecoder {
final BytesBuilder _unprocessedBytes = BytesBuilder();
int expectedByteCount = -1;
- final void Function(String, int, _LineDecoder) _callback;
+ final void Function(String, int, LineDecoder) _callback;
- _LineDecoder.withCallback(this._callback);
+ LineDecoder.withCallback(this._callback);
void add(List<int> chunk) {
while (chunk.isNotEmpty) {
diff --git a/lib/src/sync_http.dart b/lib/src/sync_http.dart
index db91d3b..e28839f 100644
--- a/lib/src/sync_http.dart
+++ b/lib/src/sync_http.dart
@@ -2,7 +2,12 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-part of sync.http;
+import 'dart:convert';
+import 'dart:io'
+ show ContentType, HttpException, HttpHeaders, RawSynchronousSocket;
+import 'dart:typed_data' show BytesBuilder;
+
+import 'line_decoder.dart';
// ignore: avoid_classes_with_only_static_members
/// A simple synchronous HTTP client.
@@ -368,7 +373,7 @@
var contentLength = 0;
var contentRead = 0;
- void processLine(String line, int bytesRead, _LineDecoder decoder) {
+ void processLine(String line, int bytesRead, LineDecoder decoder) {
if (inBody) {
body.write(line);
contentRead += bytesRead;
@@ -404,7 +409,7 @@
}
}
- final lineDecoder = _LineDecoder.withCallback(processLine);
+ final lineDecoder = LineDecoder.withCallback(processLine);
try {
while (!inHeader ||
diff --git a/lib/sync_http.dart b/lib/sync_http.dart
index 19700a7..6b2bf82 100644
--- a/lib/sync_http.dart
+++ b/lib/sync_http.dart
@@ -2,12 +2,4 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library sync.http;
-
-import 'dart:convert';
-import 'dart:io'
- show ContentType, HttpException, HttpHeaders, RawSynchronousSocket;
-import 'dart:typed_data' show BytesBuilder;
-
-part 'src/line_decoder.dart';
-part 'src/sync_http.dart';
+export 'src/sync_http.dart';
diff --git a/pubspec.yaml b/pubspec.yaml
index 7089387..795ab17 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,11 +1,11 @@
name: sync_http
-version: 0.3.2-dev
+version: 0.3.2-wip
description: Synchronous HTTP client for Dart.
repository: https://github.com/google/sync_http.dart
environment:
- sdk: '>=2.18.0 <3.0.0'
+ sdk: ^3.0.0
dev_dependencies:
- lints: ^2.0.0
+ dart_flutter_team_lints: ^2.0.0
test: ^1.16.0
diff --git a/test/http_basic_test.dart b/test/http_basic_test.dart
index d3234f2..34d6468 100644
--- a/test/http_basic_test.dart
+++ b/test/http_basic_test.dart
@@ -81,10 +81,6 @@
bool get isStarted => _state == TestServerStatusState.started;
- bool get isStopped => _state == TestServerStatusState.stopped;
-
- bool get isError => _state == TestServerStatusState.error;
-
int? get port => _port;
final TestServerStatusState _state;