move to pkg:dart_flutter_team_lints lints, fix code, bump min SDK (#87)
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml
index 8c8f4ab..20b28de 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.14.0, dev]
+ sdk: [2.19.0, dev]
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2b90a0a..0d73828 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.1.2-dev
+
+* Require Dart 2.19
+
## 2.1.1
* Require Dart 2.14
diff --git a/analysis_options.yaml b/analysis_options.yaml
index 517b597..8e5d4a7 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,14 +1,8 @@
-include: package:lints/recommended.yaml
+include: package:dart_flutter_team_lints/analysis_options.yaml
analyzer:
language:
strict-casts: true
- # These are errors when building in Google
- errors:
- unused_import: error
- unused_element: error
- unused_local_variable: error
- dead_code: error
linter:
rules:
@@ -17,3 +11,4 @@
- omit_local_variable_types
- prefer_single_quotes
- unawaited_futures
+ - use_super_parameters
diff --git a/lib/src/close_guarantee_channel.dart b/lib/src/close_guarantee_channel.dart
index 25f5022..13432d1 100644
--- a/lib/src/close_guarantee_channel.dart
+++ b/lib/src/close_guarantee_channel.dart
@@ -12,7 +12,7 @@
/// that closing the sink causes the stream to close before it emits any more
/// events
///
-/// This is exposed via [new StreamChannel.withCloseGuarantee].
+/// This is exposed via [StreamChannel.withCloseGuarantee].
class CloseGuaranteeChannel<T> extends StreamChannelMixin<T> {
@override
Stream<T> get stream => _stream;
@@ -74,7 +74,7 @@
/// The [CloseGuaranteeChannel] this belongs to.
final CloseGuaranteeChannel<T> _channel;
- _CloseGuaranteeSink(StreamSink<T> inner, this._channel) : super(inner);
+ _CloseGuaranteeSink(super.inner, this._channel);
@override
Future<void> close() {
diff --git a/lib/src/disconnector.dart b/lib/src/disconnector.dart
index a424146..61969cb 100644
--- a/lib/src/disconnector.dart
+++ b/lib/src/disconnector.dart
@@ -97,7 +97,7 @@
}
@override
- void addError(error, [StackTrace? stackTrace]) {
+ void addError(Object error, [StackTrace? stackTrace]) {
if (_closed) throw StateError('Cannot add event after closing.');
if (_inAddStream) {
throw StateError('Cannot add event while adding stream.');
diff --git a/lib/src/guarantee_channel.dart b/lib/src/guarantee_channel.dart
index 4780b04..2aa8b7b 100644
--- a/lib/src/guarantee_channel.dart
+++ b/lib/src/guarantee_channel.dart
@@ -10,7 +10,7 @@
/// A [StreamChannel] that enforces the stream channel guarantees.
///
-/// This is exposed via [new StreamChannel.withGuarantees].
+/// This is exposed via [StreamChannel.withGuarantees].
class GuaranteeChannel<T> extends StreamChannelMixin<T> {
@override
Stream<T> get stream => _streamController.stream;
@@ -126,7 +126,7 @@
}
@override
- void addError(error, [StackTrace? stackTrace]) {
+ void addError(Object error, [StackTrace? stackTrace]) {
if (_closed) throw StateError('Cannot add event after closing.');
if (_inAddStream) {
throw StateError('Cannot add event while adding stream.');
diff --git a/lib/src/multi_channel.dart b/lib/src/multi_channel.dart
index a78ddbc..82f59c7 100644
--- a/lib/src/multi_channel.dart
+++ b/lib/src/multi_channel.dart
@@ -237,7 +237,7 @@
// Convert this to a list because the close is dispatched synchronously, and
// that could conceivably remove a controller from [_controllers].
- for (var controller in List.from(_controllers.values)) {
+ for (var controller in _controllers.values.toList(growable: false)) {
controller.local.sink.close();
}
_controllers.clear();
@@ -269,5 +269,5 @@
VirtualChannel._(this._parent, this.id, this.stream, this.sink);
@override
- VirtualChannel<T> virtualChannel([id]) => _parent.virtualChannel(id);
+ VirtualChannel<T> virtualChannel([int? id]) => _parent.virtualChannel(id);
}
diff --git a/lib/stream_channel.dart b/lib/stream_channel.dart
index 4722aa3..85f9a97 100644
--- a/lib/stream_channel.dart
+++ b/lib/stream_channel.dart
@@ -6,8 +6,8 @@
import 'package:async/async.dart';
-import 'src/guarantee_channel.dart';
import 'src/close_guarantee_channel.dart';
+import 'src/guarantee_channel.dart';
import 'src/stream_channel_transformer.dart';
export 'src/delegating_stream_channel.dart';
@@ -75,9 +75,9 @@
/// Creates a new [StreamChannel] that communicates over [stream] and [sink].
///
- /// Unlike [new StreamChannel], this enforces the guarantees listed in the
+ /// Unlike [StreamChannel.new], this enforces the guarantees listed in the
/// [StreamChannel] documentation. This makes it somewhat less efficient than
- /// just wrapping a stream and a sink directly, so [new StreamChannel] should
+ /// just wrapping a stream and a sink directly, so [StreamChannel.new] should
/// be used when the guarantees are provided natively.
///
/// If [allowSinkErrors] is `false`, errors are not allowed to be passed to
diff --git a/pubspec.yaml b/pubspec.yaml
index ff6a50c..5eb57ae 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,16 +1,16 @@
name: stream_channel
-version: 2.1.1
+version: 2.1.2-dev
description: >-
An abstraction for two-way communication channels based on the Dart Stream
class.
repository: https://github.com/dart-lang/stream_channel
environment:
- sdk: '>=2.14.0 <3.0.0'
+ sdk: '>=2.19.0 <3.0.0'
dependencies:
async: ^2.5.0
dev_dependencies:
- lints: ^1.0.0
+ dart_flutter_team_lints: ^1.0.0
test: ^1.16.0
diff --git a/test/disconnector_test.dart b/test/disconnector_test.dart
index 66773b5..28f3fee 100644
--- a/test/disconnector_test.dart
+++ b/test/disconnector_test.dart
@@ -142,7 +142,7 @@
/// The completer for the future returned by [close].
final completer = Completer();
- _CloseCompleterSink(StreamSink inner) : super(inner);
+ _CloseCompleterSink(super.inner);
@override
Future<void> close() {
diff --git a/test/isolate_channel_test.dart b/test/isolate_channel_test.dart
index a754421..1850664 100644
--- a/test/isolate_channel_test.dart
+++ b/test/isolate_channel_test.dart
@@ -3,6 +3,8 @@
// BSD-style license that can be found in the LICENSE file.
@TestOn('vm')
+library;
+
import 'dart:async';
import 'dart:isolate';
diff --git a/test/multi_channel_test.dart b/test/multi_channel_test.dart
index 763e6b8..ee6f8d2 100644
--- a/test/multi_channel_test.dart
+++ b/test/multi_channel_test.dart
@@ -348,8 +348,8 @@
group('stream channel rules', () {
group('for the main stream:', () {
test(
- 'closing the sink causes the stream to close before it emits any more '
- 'events', () {
+ 'closing the sink causes the stream to close before it emits any '
+ 'more events', () {
channel1.sink.add(1);
channel1.sink.add(2);
channel1.sink.add(3);
@@ -370,7 +370,8 @@
channel2.sink.add(3);
unawaited(channel2.sink.close());
- // None of our channel.sink additions should make it to the other endpoint.
+ // None of our channel.sink additions should make it to the other
+ // endpoint.
channel1.stream.listen(expectAsync1((_) {}, count: 0));
await pumpEventQueue();
});
@@ -415,8 +416,8 @@
});
test(
- 'closing the sink causes the stream to close before it emits any more '
- 'events', () {
+ 'closing the sink causes the stream to close before it emits any '
+ 'more events', () {
virtual1.sink.add(1);
virtual1.sink.add(2);
virtual1.sink.add(3);
@@ -437,7 +438,8 @@
virtual2.sink.add(3);
unawaited(virtual2.sink.close());
- // None of our virtual.sink additions should make it to the other endpoint.
+ // None of our virtual.sink additions should make it to the other
+ // endpoint.
virtual1.stream.listen(expectAsync1((_) {}, count: 0));
await pumpEventQueue();
});