Skip to content

Commit 3d8fb7f

Browse files
authored
Update and fix latest lints, bump min SDK to 3.1 (dart-archive/stream_transform#178)
1 parent db300b6 commit 3d8fb7f

25 files changed

+85
-95
lines changed

pkgs/stream_transform/.github/workflows/test-package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ jobs:
4747
matrix:
4848
# Add macos-latest and/or windows-latest if relevant for this package.
4949
os: [ubuntu-latest]
50-
# Bump SDK for Legacy tets when changning min SDK.
51-
sdk: [2.18.0, dev]
50+
# Bump SDK for Legacy tests when changing min SDK.
51+
sdk: [3.1, dev]
5252
steps:
5353
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
5454
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d

pkgs/stream_transform/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
## 2.1.1-dev
1+
## 2.1.1-wip
22

3-
- Require Dart 2.18 or greater
3+
- Require Dart 3.1 or greater
44
- Forward errors from the `trigger` future through to the result stream in
55
`takeUntil`. Previously an error would have not closed the stream, and instead
66
raised as an unhandled async error.
Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include: package:lints/recommended.yaml
1+
include: package:dart_flutter_team_lints/analysis_options.yaml
22

33
analyzer:
44
language:
@@ -7,24 +7,10 @@ analyzer:
77

88
linter:
99
rules:
10-
- always_declare_return_types
1110
- avoid_bool_literals_in_conditional_expressions
1211
- avoid_classes_with_only_static_members
13-
- avoid_returning_null
1412
- avoid_returning_this
1513
- avoid_unused_constructor_parameters
1614
- cascade_invocations
17-
- comment_references
18-
- directives_ordering
1915
- join_return_with_assignment
2016
- no_adjacent_strings_in_list
21-
- omit_local_variable_types
22-
- only_throw_errors
23-
- prefer_const_constructors
24-
- prefer_single_quotes
25-
- test_types_in_equals
26-
- throw_in_finally
27-
- unawaited_futures
28-
- unnecessary_lambdas
29-
- unnecessary_parenthesis
30-
- unnecessary_statements

pkgs/stream_transform/lib/src/async_map.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ extension AsyncMap<T> on Stream<T> {
5959
/// pending event.
6060
///
6161
/// Errors from this stream are forwarded directly to the result stream.
62-
/// Errors during the conversion are also forwarded to the result stream and are
63-
/// considered completing work so the next values are let through.
62+
/// Errors during the conversion are also forwarded to the result stream and
63+
/// are considered completing work so the next values are let through.
6464
///
6565
/// The result stream will not close until this stream closes and all pending
6666
/// conversions have finished.
@@ -72,7 +72,7 @@ extension AsyncMap<T> on Stream<T> {
7272
trigger: workFinished.stream,
7373
aggregate: _dropPrevious,
7474
longPoll: true,
75-
onEmpty: _ignore)
75+
onEmpty: _ignore<T>)
7676
._asyncMapThen(convert, workFinished.add);
7777
}
7878

pkgs/stream_transform/lib/src/combine_latest.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ extension CombineLatest<T> on Stream<T> {
152152
/// at least once, the result stream will emit any time any source stream
153153
/// emits.
154154
///
155-
/// The result stream will not close until all source streams have closed. When
156-
/// a source stream closes, the result stream will continue to emit the last
157-
/// value from the closed stream when the other source streams emit until the
158-
/// result stream has closed. If a source stream closes without emitting any
159-
/// value, the result stream will close as well.
155+
/// The result stream will not close until all source streams have closed.
156+
/// When a source stream closes, the result stream will continue to emit the
157+
/// last value from the closed stream when the other source streams emit until
158+
/// the result stream has closed. If a source stream closes without emitting
159+
/// any value, the result stream will close as well.
160160
///
161161
/// For example:
162162
///

pkgs/stream_transform/lib/src/switch.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ extension Switch<T> on Stream<T> {
1919
///
2020
/// This means that the source stream is not paused until a sub stream
2121
/// returned from the [convert] callback is done. Instead, the subscription
22-
/// to the sub stream is canceled as soon as the source stream emits a new event.
22+
/// to the sub stream is canceled as soon as the source stream emits a new
23+
/// event.
2324
///
2425
/// Errors from [convert], the source stream, or any of the sub streams are
2526
/// forwarded to the result stream.
@@ -36,7 +37,8 @@ extension Switch<T> on Stream<T> {
3637
///
3738
/// See also:
3839
/// - [concurrentAsyncExpand], which emits events from all sub streams
39-
/// concurrently instead of cancelling subscriptions to previous subs streams.
40+
/// concurrently instead of cancelling subscriptions to previous subs
41+
/// streams.
4042
Stream<S> switchMap<S>(Stream<S> Function(T) convert) {
4143
return map(convert).switchLatest();
4244
}

pkgs/stream_transform/lib/src/where.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ extension Where<T> on Stream<T> {
2828
/// Events on the result stream will be emitted in the order that [test]
2929
/// completes which may not match the order of this stream.
3030
///
31-
/// If the source stream is a broadcast stream the result will be as well. When
32-
/// used with a broadcast stream behavior also differs from [where] in that
33-
/// the [test] function is only called once per event, rather than once per
34-
/// listener per event.
31+
/// If the source stream is a broadcast stream the result will be as well.
32+
/// When used with a broadcast stream behavior also differs from [where] in
33+
/// that the [test] function is only called once per event, rather than once
34+
/// per listener per event.
3535
///
3636
/// Errors from the source stream are forwarded directly to the result stream.
3737
/// Errors from [test] are also forwarded to the result stream.

pkgs/stream_transform/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name: stream_transform
2-
version: 2.1.1-dev
2+
version: 2.1.1-wip
33
description: A collection of utilities to transform and manipulate streams.
44
repository: https://github.com/dart-lang/stream_transform
55

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

99
dev_dependencies:
1010
async: ^2.5.0
11+
dart_flutter_team_lints: ^2.0.0
1112
fake_async: ^1.3.0
12-
lints: ^2.0.0
1313
test: ^1.16.0

pkgs/stream_transform/test/async_expand_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void main() {
1313
test('forwards errors from the convert callback', () async {
1414
var errors = <String>[];
1515
var source = Stream.fromIterable([1, 2, 3]);
16-
source.concurrentAsyncExpand((i) {
16+
source.concurrentAsyncExpand<void>((i) {
1717
// ignore: only_throw_errors
1818
throw 'Error: $i';
1919
}).listen((_) {}, onError: errors.add);

pkgs/stream_transform/test/async_map_buffer_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ void main() {
158158

159159
if (streamType == 'broadcast') {
160160
test('multiple listeners all get values', () async {
161-
var otherValues = [];
161+
var otherValues = <String>[];
162162
transformed.listen(otherValues.add);
163163
values.add(1);
164164
await Future(() {});

0 commit comments

Comments
 (0)