From 26690d31dba57e5d3b40337aa57a10abae49c3ff Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Tue, 13 Feb 2024 11:50:26 -0800 Subject: [PATCH 1/3] Require Dart 3.2, update and fix lints --- .github/workflows/test-package.yml | 2 +- CHANGELOG.md | 2 +- analysis_options.yaml | 9 +++--- lib/src/subscription_stream.dart | 2 +- pubspec.yaml | 4 +-- test/async_cache_test.dart | 2 +- test/cancelable_operation_test.dart | 4 +-- test/lazy_stream_test.dart | 6 ++-- test/null_stream_sink_test.dart | 8 ++--- test/reject_errors_test.dart | 4 +-- test/restartable_timer_test.dart | 41 +++++++++++++------------ test/result/result_captureAll_test.dart | 2 +- test/result/result_test.dart | 22 ++++++------- test/sink_base_test.dart | 2 +- test/stream_closer_test.dart | 2 +- test/stream_completer_test.dart | 6 ++-- test/stream_extensions_test.dart | 4 +-- test/stream_queue_test.dart | 3 +- test/stream_sink_transformer_test.dart | 4 +-- test/subscription_stream_test.dart | 4 +-- test/utils.dart | 4 +-- 21 files changed, 69 insertions(+), 68 deletions(-) diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml index 04c07a6..cf89e3c 100644 --- a/.github/workflows/test-package.yml +++ b/.github/workflows/test-package.yml @@ -47,7 +47,7 @@ jobs: matrix: # Add macos-latest and/or windows-latest if relevant for this package. os: [ubuntu-latest] - sdk: [2.19.0, dev] + sdk: [3.2, dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 diff --git a/CHANGELOG.md b/CHANGELOG.md index ccda9d8..b2b6f25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## 2.12.0-wip -- Require Dart 2.19 +- Require Dart 3.2 ## 2.11.0 diff --git a/analysis_options.yaml b/analysis_options.yaml index 260fdb0..265204b 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,4 +1,4 @@ -# https://dart.dev/guides/language/analysis-options +# https://dart.dev/tools/analysis#the-analysis-options-file include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: @@ -7,16 +7,15 @@ analyzer: errors: only_throw_errors: ignore unawaited_futures: ignore + inference_failure_on_instance_creation: ignore + inference_failure_on_function_invocation: ignore + inference_failure_on_collection_literal: ignore linter: rules: - avoid_unused_constructor_parameters - - comment_references - literal_only_boolean_expressions - missing_whitespace_between_adjacent_strings - no_adjacent_strings_in_list - no_runtimeType_toString - package_api_docs - - prefer_relative_imports - - test_types_in_equals - - use_super_parameters diff --git a/lib/src/subscription_stream.dart b/lib/src/subscription_stream.dart index 5572adf..9ce4942 100644 --- a/lib/src/subscription_stream.dart +++ b/lib/src/subscription_stream.dart @@ -73,7 +73,7 @@ class _CancelOnErrorSubscriptionWrapper @override void onError(Function? handleError) { // Cancel when receiving an error. - super.onError((error, StackTrace stackTrace) { + super.onError((Object error, StackTrace stackTrace) { // Wait for the cancel to complete before sending the error event. super.cancel().whenComplete(() { if (handleError is ZoneBinaryCallback) { diff --git a/pubspec.yaml b/pubspec.yaml index dd2046c..a758422 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,14 +4,14 @@ description: Utility functions and classes related to the 'dart:async' library. repository: https://github.com/dart-lang/async environment: - sdk: '>=2.19.0 <4.0.0' + sdk: ^3.2.0 dependencies: collection: ^1.15.0 meta: ^1.1.7 dev_dependencies: - dart_flutter_team_lints: ^1.0.0 + dart_flutter_team_lints: ^2.0.0 fake_async: ^1.2.0 stack_trace: ^1.10.0 test: ^1.16.0 diff --git a/test/async_cache_test.dart b/test/async_cache_test.dart index 77bda7c..c1e38b7 100644 --- a/test/async_cache_test.dart +++ b/test/async_cache_test.dart @@ -60,7 +60,7 @@ void main() { Future throwingCall() async => throw Exception(); await expectLater(cache.fetch(throwingCall), throwsA(isException)); // To let the timer invalidate the cache - await Future.delayed(Duration(milliseconds: 5)); + await Future.delayed(const Duration(milliseconds: 5)); Future call() async => 'Completed'; expect(await cache.fetch(call), 'Completed', reason: 'Cache invalidates'); diff --git a/test/cancelable_operation_test.dart b/test/cancelable_operation_test.dart index 6d415ed..e6d3d4a 100644 --- a/test/cancelable_operation_test.dart +++ b/test/cancelable_operation_test.dart @@ -574,8 +574,8 @@ void main() { test('waits for chained cancellation', () async { var completer = CancelableCompleter(); var chainedOperation = completer.operation - .then((_) => Future.delayed(Duration(milliseconds: 1))) - .then((_) => Future.delayed(Duration(milliseconds: 1))); + .then((_) => Future.delayed(const Duration(milliseconds: 1))) + .then((_) => Future.delayed(const Duration(milliseconds: 1))); await completer.operation.cancel(); expect(completer.operation.isCanceled, true); diff --git a/test/lazy_stream_test.dart b/test/lazy_stream_test.dart index cde1928..9785b2e 100644 --- a/test/lazy_stream_test.dart +++ b/test/lazy_stream_test.dart @@ -14,7 +14,7 @@ void main() { var callbackCalled = false; var stream = LazyStream(expectAsync0(() { callbackCalled = true; - return Stream.empty(); + return const Stream.empty(); })); await flushMicrotasks(); @@ -28,7 +28,7 @@ void main() { var callbackCalled = false; var stream = LazyStream(expectAsync0(() { callbackCalled = true; - return Stream.empty(); + return const Stream.empty(); })); await flushMicrotasks(); @@ -95,7 +95,7 @@ void main() { late LazyStream stream; stream = LazyStream(expectAsync0(() { expect(() => stream.listen(null), throwsStateError); - return Stream.empty(); + return const Stream.empty(); })); stream.listen(null); }); diff --git a/test/null_stream_sink_test.dart b/test/null_stream_sink_test.dart index 649cbad..fd86368 100644 --- a/test/null_stream_sink_test.dart +++ b/test/null_stream_sink_test.dart @@ -51,7 +51,7 @@ void main() { expect(() => sink.add(1), throwsStateError); expect(() => sink.addError('oh no'), throwsStateError); - expect(() => sink.addStream(Stream.empty()), throwsStateError); + expect(() => sink.addStream(const Stream.empty()), throwsStateError); }); group('addStream', () { @@ -93,15 +93,15 @@ void main() { test('causes events to throw StateErrors until the future completes', () async { var sink = NullStreamSink(); - var future = sink.addStream(Stream.empty()); + var future = sink.addStream(const Stream.empty()); expect(() => sink.add(1), throwsStateError); expect(() => sink.addError('oh no'), throwsStateError); - expect(() => sink.addStream(Stream.empty()), throwsStateError); + expect(() => sink.addStream(const Stream.empty()), throwsStateError); await future; sink.add(1); sink.addError('oh no'); - expect(sink.addStream(Stream.empty()), completes); + expect(sink.addStream(const Stream.empty()), completes); }); }); }); diff --git a/test/reject_errors_test.dart b/test/reject_errors_test.dart index 5b8b3e7..995f1bd 100644 --- a/test/reject_errors_test.dart +++ b/test/reject_errors_test.dart @@ -171,7 +171,7 @@ void main() { test('throws on addStream()', () { var sink = controller.sink.rejectErrors()..close(); - expect(() => sink.addStream(Stream.empty()), throwsStateError); + expect(() => sink.addStream(const Stream.empty()), throwsStateError); }); test('allows close()', () { @@ -196,7 +196,7 @@ void main() { test('throws on addStream()', () { var sink = controller.sink.rejectErrors() ..addStream(StreamController().stream); - expect(() => sink.addStream(Stream.empty()), throwsStateError); + expect(() => sink.addStream(const Stream.empty()), throwsStateError); }); test('throws on close()', () { diff --git a/test/restartable_timer_test.dart b/test/restartable_timer_test.dart index 41f52ab..4aab287 100644 --- a/test/restartable_timer_test.dart +++ b/test/restartable_timer_test.dart @@ -10,14 +10,14 @@ void main() { test('runs the callback once the duration has elapsed', () { FakeAsync().run((async) { var fired = false; - RestartableTimer(Duration(seconds: 5), () { + RestartableTimer(const Duration(seconds: 5), () { fired = true; }); - async.elapse(Duration(seconds: 4)); + async.elapse(const Duration(seconds: 4)); expect(fired, isFalse); - async.elapse(Duration(seconds: 1)); + async.elapse(const Duration(seconds: 1)); expect(fired, isTrue); }); }); @@ -25,15 +25,15 @@ void main() { test("doesn't run the callback if the timer is canceled", () { FakeAsync().run((async) { var fired = false; - var timer = RestartableTimer(Duration(seconds: 5), () { + var timer = RestartableTimer(const Duration(seconds: 5), () { fired = true; }); - async.elapse(Duration(seconds: 4)); + async.elapse(const Duration(seconds: 4)); expect(fired, isFalse); timer.cancel(); - async.elapse(Duration(seconds: 4)); + async.elapse(const Duration(seconds: 4)); expect(fired, isFalse); }); }); @@ -41,18 +41,18 @@ void main() { test('resets the duration if the timer is reset before it fires', () { FakeAsync().run((async) { var fired = false; - var timer = RestartableTimer(Duration(seconds: 5), () { + var timer = RestartableTimer(const Duration(seconds: 5), () { fired = true; }); - async.elapse(Duration(seconds: 4)); + async.elapse(const Duration(seconds: 4)); expect(fired, isFalse); timer.reset(); - async.elapse(Duration(seconds: 4)); + async.elapse(const Duration(seconds: 4)); expect(fired, isFalse); - async.elapse(Duration(seconds: 1)); + async.elapse(const Duration(seconds: 1)); expect(fired, isTrue); }); }); @@ -60,19 +60,19 @@ void main() { test('re-runs the callback if the timer is reset after firing', () { FakeAsync().run((async) { var fired = 0; - var timer = RestartableTimer(Duration(seconds: 5), () { + var timer = RestartableTimer(const Duration(seconds: 5), () { fired++; }); - async.elapse(Duration(seconds: 5)); + async.elapse(const Duration(seconds: 5)); expect(fired, equals(1)); timer.reset(); - async.elapse(Duration(seconds: 5)); + async.elapse(const Duration(seconds: 5)); expect(fired, equals(2)); timer.reset(); - async.elapse(Duration(seconds: 5)); + async.elapse(const Duration(seconds: 5)); expect(fired, equals(3)); }); }); @@ -80,27 +80,28 @@ void main() { test('runs the callback if the timer is reset after being canceled', () { FakeAsync().run((async) { var fired = false; - var timer = RestartableTimer(Duration(seconds: 5), () { + var timer = RestartableTimer(const Duration(seconds: 5), () { fired = true; }); - async.elapse(Duration(seconds: 4)); + async.elapse(const Duration(seconds: 4)); expect(fired, isFalse); timer.cancel(); - async.elapse(Duration(seconds: 4)); + async.elapse(const Duration(seconds: 4)); expect(fired, isFalse); timer.reset(); - async.elapse(Duration(seconds: 5)); + async.elapse(const Duration(seconds: 5)); expect(fired, isTrue); }); }); test("only runs the callback once if the timer isn't reset", () { FakeAsync().run((async) { - RestartableTimer(Duration(seconds: 5), expectAsync0(() {}, count: 1)); - async.elapse(Duration(seconds: 10)); + RestartableTimer( + const Duration(seconds: 5), expectAsync0(() {}, count: 1)); + async.elapse(const Duration(seconds: 10)); }); }); } diff --git a/test/result/result_captureAll_test.dart b/test/result/result_captureAll_test.dart index 25c5775..e85999e 100644 --- a/test/result/result_captureAll_test.dart +++ b/test/result/result_captureAll_test.dart @@ -147,7 +147,7 @@ void main() { expect(all, completion(expected)); - var completeFunctions = List.generate(n, (i) { + var completeFunctions = List.generate(n, (i) { var c = cs[i]; return () => throws(i) ? c.completeError('$i', someStack) : c.complete(i); diff --git a/test/result/result_test.dart b/test/result/result_test.dart index 568a891..13a5d53 100644 --- a/test/result/result_test.dart +++ b/test/result/result_test.dart @@ -61,7 +61,7 @@ void main() { var c = Completer(); c.future.then(expectAsync1((int v) { expect(v, equals(42)); - }), onError: (e, s) { + }), onError: (Object? e, s) { fail('Unexpected error'); }); result.complete(c); @@ -100,7 +100,7 @@ void main() { Result result = ValueResult(42); result.asFuture.then(expectAsync1((int v) { expect(v, equals(42)); - }), onError: (e, s) { + }), onError: (Object? e, s) { fail('Unexpected error'); }); }); @@ -122,7 +122,7 @@ void main() { expect(result.isError, isFalse); var value = result.asValue!; expect(value.value, equals(42)); - }), onError: (e, s) { + }), onError: (Object? e, s) { fail('Unexpected error: $e'); }); }); @@ -135,7 +135,7 @@ void main() { var error = result.asError!; expect(error.error, equals('BAD')); expect(error.stackTrace, same(stack)); - }), onError: (e, s) { + }), onError: (Object? e, s) { fail('Unexpected error: $e'); }); }); @@ -144,7 +144,7 @@ void main() { var future = Future>.value(Result.value(42)); Result.release(future).then(expectAsync1((v) { expect(v, equals(42)); - }), onError: (e, s) { + }), onError: (Object? e, s) { fail('Unexpected error: $e'); }); }); @@ -207,7 +207,7 @@ void main() { expect(v, equals(expected.asValue!.value)); } - void errorListener(error, StackTrace stackTrace) { + void errorListener(Object error, StackTrace stackTrace) { expect(expectedList.isEmpty, isFalse); Result expected = expectedList.removeFirst(); expect(expected.isError, isTrue); @@ -263,7 +263,7 @@ void main() { test('handle unary', () { var result = ErrorResult('error', stack); var called = false; - result.handle((error) { + result.handle((Object? error) { called = true; expect(error, 'error'); }); @@ -273,7 +273,7 @@ void main() { test('handle binary', () { var result = ErrorResult('error', stack); var called = false; - result.handle((error, stackTrace) { + result.handle((Object? error, Object? stackTrace) { called = true; expect(error, 'error'); expect(stackTrace, same(stack)); @@ -284,7 +284,7 @@ void main() { test('handle unary and binary', () { var result = ErrorResult('error', stack); var called = false; - result.handle((error, [stackTrace]) { + result.handle((Object? error, [Object? stackTrace]) { called = true; expect(error, 'error'); expect(stackTrace, same(stack)); @@ -344,11 +344,11 @@ class TestSink implements EventSink { onDone(); } - static void _nullData(value) { + static void _nullData(dynamic value) { fail('Unexpected sink add: $value'); } - static void _nullError(e, StackTrace s) { + static void _nullError(dynamic e, StackTrace s) { fail('Unexpected sink addError: $e'); } diff --git a/test/sink_base_test.dart b/test/sink_base_test.dart index 95f51c9..10f896a 100644 --- a/test/sink_base_test.dart +++ b/test/sink_base_test.dart @@ -328,7 +328,7 @@ void main() { sink.flush(); expect(() => sink.add([0]), throwsStateError); expect(() => sink.addError('oh no'), throwsStateError); - expect(() => sink.addStream(Stream.empty()), throwsStateError); + expect(() => sink.addStream(const Stream.empty()), throwsStateError); expect(() => sink.flush(), throwsStateError); expect(() => sink.close(), throwsStateError); }); diff --git a/test/stream_closer_test.dart b/test/stream_closer_test.dart index 28ab970..a2bad1a 100644 --- a/test/stream_closer_test.dart +++ b/test/stream_closer_test.dart @@ -27,7 +27,7 @@ void main() { }); test('transforms a broadcast stream into a broadcast stream', () { - expect(Stream.empty().transform(closer).isBroadcast, isTrue); + expect(const Stream.empty().transform(closer).isBroadcast, isTrue); }); test("doesn't eagerly listen", () { diff --git a/test/stream_completer_test.dart b/test/stream_completer_test.dart index eaeb719..eb1d485 100644 --- a/test/stream_completer_test.dart +++ b/test/stream_completer_test.dart @@ -274,7 +274,7 @@ void main() { var subscription = completer.stream.listen(null); Object lastEvent = 0; subscription.onData((value) => lastEvent = value); - subscription.onError((value) => lastEvent = '$value'); + subscription.onError((Object value) => lastEvent = '$value'); subscription.onDone(() => lastEvent = -1); completer.setSourceStream(controller.stream); await flushMicrotasks(); @@ -285,7 +285,7 @@ void main() { await flushMicrotasks(); expect(lastEvent, '2'); subscription.onData((value) => lastEvent = -value); - subscription.onError((value) => lastEvent = '${-(value as int)}'); + subscription.onError((Object value) => lastEvent = '${-(value as int)}'); controller.add(1); await flushMicrotasks(); expect(lastEvent, -1); @@ -323,7 +323,7 @@ void main() { await flushMicrotasks(); expect(controller.hasListener, isTrue); controller.addError(42); - await done.then(unreachable('data'), onError: (error) { + await done.then(unreachable('data'), onError: (Object error) { expect(error, 42); }); expect(controller.hasListener, isFalse); diff --git a/test/stream_extensions_test.dart b/test/stream_extensions_test.dart index c922923..b43dedc 100644 --- a/test/stream_extensions_test.dart +++ b/test/stream_extensions_test.dart @@ -10,7 +10,7 @@ import 'package:test/test.dart'; void main() { group('.slices', () { test('empty', () { - expect(Stream.empty().slices(1).toList(), completion(equals([]))); + expect(const Stream.empty().slices(1).toList(), completion(equals([]))); }); test('with the same length as the iterable', () { @@ -67,7 +67,7 @@ void main() { }); test('returns null for an empty stream', () { - expect(Stream.empty().firstOrNull, completion(isNull)); + expect(const Stream.empty().firstOrNull, completion(isNull)); }); test('cancels the subscription after an event', () async { diff --git a/test/stream_queue_test.dart b/test/stream_queue_test.dart index 7c575c0..5e5ad41 100644 --- a/test/stream_queue_test.dart +++ b/test/stream_queue_test.dart @@ -250,7 +250,8 @@ void main() { var skip4 = events.skip(1); var index = 0; // Check that futures complete in order. - Func1Required sequence(expectedValue, sequenceIndex) => (value) { + Func1Required sequence(int expectedValue, int sequenceIndex) => + (value) { expect(value, expectedValue); expect(index, sequenceIndex); index++; diff --git a/test/stream_sink_transformer_test.dart b/test/stream_sink_transformer_test.dart index e5f6baa..905e713 100644 --- a/test/stream_sink_transformer_test.dart +++ b/test/stream_sink_transformer_test.dart @@ -43,7 +43,7 @@ void main() { var results = []; controller.stream.listen(expectAsync1((_) {}, count: 0), - onError: (error, stackTrace) { + onError: (Object error, stackTrace) { results.add(error); }, onDone: expectAsync0(() { expect(results, equals([2, 4, 6])); @@ -142,7 +142,7 @@ void main() { var results = []; controller.stream.listen(expectAsync1((_) {}, count: 0), - onError: (error, stackTrace) { + onError: (Object error, stackTrace) { results.add(error); }, onDone: expectAsync0(() { expect(results, equals([2, 4, 6])); diff --git a/test/subscription_stream_test.dart b/test/subscription_stream_test.dart index ea626b1..a825c25 100644 --- a/test/subscription_stream_test.dart +++ b/test/subscription_stream_test.dart @@ -108,9 +108,9 @@ void main() { test('- subscriptionStream: yes', () async { var completer = Completer(); - var events = []; + var events = []; subscriptionStream.listen(events.add, - onError: (value) { + onError: (Object? value) { events.add(value); completer.complete(); }, diff --git a/test/utils.dart b/test/utils.dart index fd87a4e..d2d9fe6 100644 --- a/test/utils.dart +++ b/test/utils.dart @@ -40,10 +40,10 @@ Matcher throwsZoned(Matcher matcher) => predicate((void Function() callback) { /// A matcher that runs a callback in its own zone and asserts that that zone /// emits a [TypeError]. -final throwsZonedTypeError = throwsZoned(TypeMatcher()); +final throwsZonedTypeError = throwsZoned(isA()); /// A matcher that matches a callback or future that throws a [TypeError]. -final throwsTypeError = throwsA(TypeMatcher()); +final throwsTypeError = throwsA(isA()); /// A badly behaved stream which throws if it's ever listened to. /// From f5a08a31a19d5206836bf6401b63c7abfe67ac9f Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Tue, 13 Feb 2024 12:03:06 -0800 Subject: [PATCH 2/3] tiny bit more cleanup --- test/async_cache_test.dart | 2 +- test/cancelable_operation_test.dart | 34 +++++++++--------- test/chunked_stream_reader.dart | 4 +-- test/future_group_test.dart | 30 ++++++++-------- test/null_stream_sink_test.dart | 4 +-- test/reject_errors_test.dart | 10 +++--- test/result/result_future_test.dart | 2 +- test/sink_base_test.dart | 9 ++--- test/stream_completer_test.dart | 46 ++++++++++++------------- test/stream_group_test.dart | 8 ++--- test/stream_queue_test.dart | 8 ++--- test/stream_sink_completer_test.dart | 10 +++--- test/stream_sink_transformer_test.dart | 2 +- test/stream_splitter_test.dart | 2 +- test/stream_zip_test.dart | 8 ++--- test/stream_zip_zone_test.dart | 4 +-- test/subscription_stream_test.dart | 8 ++--- test/subscription_transformer_test.dart | 24 ++++++------- test/utils.dart | 6 ++-- 19 files changed, 112 insertions(+), 109 deletions(-) diff --git a/test/async_cache_test.dart b/test/async_cache_test.dart index c1e38b7..f7c8caa 100644 --- a/test/async_cache_test.dart +++ b/test/async_cache_test.dart @@ -60,7 +60,7 @@ void main() { Future throwingCall() async => throw Exception(); await expectLater(cache.fetch(throwingCall), throwsA(isException)); // To let the timer invalidate the cache - await Future.delayed(const Duration(milliseconds: 5)); + await Future.delayed(const Duration(milliseconds: 5)); Future call() async => 'Completed'; expect(await cache.fetch(call), 'Completed', reason: 'Cache invalidates'); diff --git a/test/cancelable_operation_test.dart b/test/cancelable_operation_test.dart index e6d3d4a..3b096e4 100644 --- a/test/cancelable_operation_test.dart +++ b/test/cancelable_operation_test.dart @@ -105,7 +105,7 @@ void main() { }); test('is not complete until the result is available', () async { - var backingWork = Completer(); + var backingWork = Completer(); var operation = CancelableOperation.fromFuture(backingWork.future); expect(operation.isCompleted, isFalse); backingWork.complete(); @@ -132,17 +132,19 @@ void main() { test('successfully then with a future', () { completer.complete(1); - expect(() => completer.complete(Completer().future), throwsStateError); + expect(() => completer.complete(Completer().future), + throwsStateError); }); test('with a future then successfully', () { - completer.complete(Completer().future); + completer.complete(Completer().future); expect(() => completer.complete(1), throwsStateError); }); test('with a future twice', () { - completer.complete(Completer().future); - expect(() => completer.complete(Completer().future), throwsStateError); + completer.complete(Completer().future); + expect(() => completer.complete(Completer().future), + throwsStateError); }); }); @@ -185,7 +187,7 @@ void main() { group('when canceled', () { test('causes the future never to fire', () async { - var completer = CancelableCompleter(); + var completer = CancelableCompleter(); completer.operation.value.whenComplete(expectAsync0(() {}, count: 0)); completer.operation.cancel(); @@ -242,7 +244,7 @@ void main() { 'does call onCancel if the completer has completed to an unfired ' 'Future', () { var completer = CancelableCompleter(onCancel: expectAsync0(() {})); - completer.complete(Completer().future); + completer.complete(Completer().future); expect(completer.operation.cancel(), completes); }); @@ -257,7 +259,7 @@ void main() { }); test('can be completed once after being canceled', () async { - var completer = CancelableCompleter(); + var completer = CancelableCompleter(); completer.operation.value.whenComplete(expectAsync0(() {}, count: 0)); await completer.operation.cancel(); completer.complete(1); @@ -265,7 +267,7 @@ void main() { }); test('fires valueOrCancellation with the given value', () { - var completer = CancelableCompleter(); + var completer = CancelableCompleter(); expect(completer.operation.valueOrCancellation(1), completion(equals(1))); completer.operation.cancel(); }); @@ -279,7 +281,7 @@ void main() { }); test('valueOrCancellation waits on the onCancel future', () async { - var innerCompleter = Completer(); + var innerCompleter = Completer(); var completer = CancelableCompleter(onCancel: () => innerCompleter.future); @@ -389,13 +391,13 @@ void main() { group('asStream()', () { test('emits a value and then closes', () { - var completer = CancelableCompleter(); + var completer = CancelableCompleter(); expect(completer.operation.asStream().toList(), completion(equals([1]))); completer.complete(1); }); test('emits an error and then closes', () { - var completer = CancelableCompleter(); + var completer = CancelableCompleter(); var queue = StreamQueue(completer.operation.asStream()); expect(queue.next, throwsA('error')); expect(queue.hasNext, completion(isFalse)); @@ -425,7 +427,7 @@ void main() { onError = expectAsync2((e, s) => 'Fake', count: 0, id: 'onError'); onCancel = expectAsync0(() => 'Fake', count: 0, id: 'onCancel'); propagateCancel = false; - originalCompleter = CancelableCompleter(); + originalCompleter = CancelableCompleter(); }); CancelableOperation runThen() { @@ -574,8 +576,8 @@ void main() { test('waits for chained cancellation', () async { var completer = CancelableCompleter(); var chainedOperation = completer.operation - .then((_) => Future.delayed(const Duration(milliseconds: 1))) - .then((_) => Future.delayed(const Duration(milliseconds: 1))); + .then((_) => Future.delayed(const Duration(milliseconds: 1))) + .then((_) => Future.delayed(const Duration(milliseconds: 1))); await completer.operation.cancel(); expect(completer.operation.isCanceled, true); @@ -655,7 +657,7 @@ void main() { onError = null; onCancel = null; propagateCancel = false; - originalCompleter = CancelableCompleter(); + originalCompleter = CancelableCompleter(); }); CancelableOperation runThenOperation() { diff --git a/test/chunked_stream_reader.dart b/test/chunked_stream_reader.dart index b4dd4f0..2fc1e8b 100644 --- a/test/chunked_stream_reader.dart +++ b/test/chunked_stream_reader.dart @@ -342,7 +342,7 @@ void main() { final r = ChunkedStreamReader(() async* { yield [1, 2, 3]; // This will hang forever, so we will call cancel() - await Completer().future; + await Completer().future; yield [4]; // this should never be reachable fail('unreachable!'); }()); @@ -362,7 +362,7 @@ void main() { final r = ChunkedStreamReader(() async* { yield [1, 2, 3]; // This will hang forever, so we will call cancel() - await Completer().future; + await Completer().future; yield [4]; // this should never be reachable fail('unreachable!'); }()); diff --git a/test/future_group_test.dart b/test/future_group_test.dart index c2b1f3f..9729c06 100644 --- a/test/future_group_test.dart +++ b/test/future_group_test.dart @@ -67,9 +67,9 @@ void main() { }); test('completes once all contained futures complete', () async { - var completer1 = Completer(); - var completer2 = Completer(); - var completer3 = Completer(); + var completer1 = Completer(); + var completer2 = Completer(); + var completer3 = Completer(); futureGroup.add(completer1.future); futureGroup.add(completer2.future); @@ -93,9 +93,9 @@ void main() { }); test('completes to the values of the futures in order of addition', () { - var completer1 = Completer(); - var completer2 = Completer(); - var completer3 = Completer(); + var completer1 = Completer(); + var completer2 = Completer(); + var completer3 = Completer(); futureGroup.add(completer1.future); futureGroup.add(completer2.future); @@ -112,9 +112,9 @@ void main() { test("completes to the first error to be emitted, even if it's not closed", () { - var completer1 = Completer(); - var completer2 = Completer(); - var completer3 = Completer(); + var completer1 = Completer(); + var completer2 = Completer(); + var completer3 = Completer(); futureGroup.add(completer1.future); futureGroup.add(completer2.future); @@ -130,9 +130,9 @@ void main() { var idle = false; futureGroup.onIdle.listen((_) => idle = true); - var completer1 = Completer(); - var completer2 = Completer(); - var completer3 = Completer(); + var completer1 = Completer(); + var completer2 = Completer(); + var completer3 = Completer(); futureGroup.add(completer1.future); futureGroup.add(completer2.future); @@ -162,7 +162,7 @@ void main() { var idle = false; futureGroup.onIdle.listen((_) => idle = true); - var completer = Completer(); + var completer = Completer(); futureGroup.add(completer.future); completer.complete(); @@ -171,7 +171,7 @@ void main() { expect(futureGroup.isIdle, isTrue); idle = false; - completer = Completer(); + completer = Completer(); futureGroup.add(completer.future); await flushMicrotasks(); @@ -206,7 +206,7 @@ void main() { futureFired = true; })); - var completer = Completer(); + var completer = Completer(); futureGroup.add(completer.future); futureGroup.close(); diff --git a/test/null_stream_sink_test.dart b/test/null_stream_sink_test.dart index fd86368..16d6986 100644 --- a/test/null_stream_sink_test.dart +++ b/test/null_stream_sink_test.dart @@ -17,7 +17,7 @@ void main() { }); test('a custom future may be passed to done', () async { - var completer = Completer(); + var completer = Completer(); var sink = NullStreamSink(done: completer.future); var doneFired = false; @@ -68,7 +68,7 @@ void main() { }); test('returns the cancel future', () async { - var completer = Completer(); + var completer = Completer(); var sink = NullStreamSink(); var controller = StreamController(onCancel: () => completer.future); diff --git a/test/reject_errors_test.dart b/test/reject_errors_test.dart index 995f1bd..27e3c25 100644 --- a/test/reject_errors_test.dart +++ b/test/reject_errors_test.dart @@ -10,7 +10,7 @@ import 'package:test/test.dart'; void main() { late StreamController controller; setUp(() { - controller = StreamController(); + controller = StreamController(); }); test('passes through data events', () { @@ -89,7 +89,7 @@ void main() { group('when the inner sink\'s done future completes', () { test('done completes', () async { - var completer = Completer(); + var completer = Completer(); var transformed = NullStreamSink(done: completer.future).rejectErrors(); var doneCompleted = false; @@ -103,7 +103,7 @@ void main() { }); test('an outstanding addStream() completes', () async { - var completer = Completer(); + var completer = Completer(); var transformed = NullStreamSink(done: completer.future).rejectErrors(); var addStreamCompleted = false; @@ -119,7 +119,7 @@ void main() { }); test('an outstanding addStream()\'s subscription is cancelled', () async { - var completer = Completer(); + var completer = Completer(); var transformed = NullStreamSink(done: completer.future).rejectErrors(); var addStreamCancelled = false; @@ -134,7 +134,7 @@ void main() { }); test('forwards an outstanding addStream()\'s cancellation error', () async { - var completer = Completer(); + var completer = Completer(); var transformed = NullStreamSink(done: completer.future).rejectErrors(); expect( diff --git a/test/result/result_future_test.dart b/test/result/result_future_test.dart index 7171005..de21884 100644 --- a/test/result/result_future_test.dart +++ b/test/result/result_future_test.dart @@ -12,7 +12,7 @@ void main() { late Completer completer; late ResultFuture future; setUp(() { - completer = Completer(); + completer = Completer(); future = ResultFuture(completer.future); }); diff --git a/test/sink_base_test.dart b/test/sink_base_test.dart index 10f896a..9cf8c10 100644 --- a/test/sink_base_test.dart +++ b/test/sink_base_test.dart @@ -80,7 +80,7 @@ void main() { }); test('all invocations of close() return the same future', () async { - var completer = Completer(); + var completer = Completer(); var sink = _StreamSink(onClose: expectAsync0(() => completer.future)); var close1Completed = false; @@ -106,7 +106,7 @@ void main() { test('done returns a future that completes once close() completes', () async { - var completer = Completer(); + var completer = Completer(); var sink = _StreamSink(onClose: expectAsync0(() => completer.future)); var doneCompleted = false; @@ -297,7 +297,7 @@ void main() { group('flush()', () { test('returns a future that completes when onFlush() is done', () async { - var completer = Completer(); + var completer = Completer(); var sink = _IOSink(onFlush: expectAsync0(() => completer.future)); var flushDone = false; @@ -324,7 +324,8 @@ void main() { }); test('locks the sink as though a stream was being added', () { - var sink = _IOSink(onFlush: expectAsync0(() => Completer().future)); + var sink = + _IOSink(onFlush: expectAsync0(() => Completer().future)); sink.flush(); expect(() => sink.add([0]), throwsStateError); expect(() => sink.addError('oh no'), throwsStateError); diff --git a/test/stream_completer_test.dart b/test/stream_completer_test.dart index eb1d485..3db28a9 100644 --- a/test/stream_completer_test.dart +++ b/test/stream_completer_test.dart @@ -11,13 +11,13 @@ import 'utils.dart'; void main() { test('a stream is linked before listening', () async { - var completer = StreamCompleter(); + var completer = StreamCompleter(); completer.setSourceStream(createStream()); expect(completer.stream.toList(), completion([1, 2, 3, 4])); }); test('listened to before a stream is linked', () async { - var completer = StreamCompleter(); + var completer = StreamCompleter(); var done = completer.stream.toList(); await flushMicrotasks(); completer.setSourceStream(createStream()); @@ -25,7 +25,7 @@ void main() { }); test("cancel before linking a stream doesn't listen on stream", () async { - var completer = StreamCompleter(); + var completer = StreamCompleter(); var subscription = completer.stream.listen(null); subscription.pause(); // Should be ignored. subscription.cancel(); @@ -33,12 +33,12 @@ void main() { }); test('listen and pause before linking stream', () async { - var controller = StreamCompleter(); + var controller = StreamCompleter(); var events = []; var subscription = controller.stream.listen(events.add); var done = subscription.asFuture(); subscription.pause(); - var sourceController = StreamController(); + var sourceController = StreamController(); sourceController ..add(1) ..add(2) @@ -60,7 +60,7 @@ void main() { }); test('pause more than once', () async { - var completer = StreamCompleter(); + var completer = StreamCompleter(); var events = []; var subscription = completer.stream.listen(events.add); var done = subscription.asFuture(); @@ -110,17 +110,17 @@ void main() { }); test('complete with setEmpty before listening', () async { - var completer = StreamCompleter(); + var completer = StreamCompleter(); completer.setEmpty(); - var done = Completer(); + var done = Completer(); completer.stream.listen(unreachable('data'), onError: unreachable('error'), onDone: done.complete); await done.future; }); test('complete with setEmpty after listening', () async { - var completer = StreamCompleter(); - var done = Completer(); + var completer = StreamCompleter(); + var done = Completer(); completer.stream.listen(unreachable('data'), onError: unreachable('error'), onDone: done.complete); completer.setEmpty(); @@ -128,7 +128,7 @@ void main() { }); test("source stream isn't listened to until completer stream is", () async { - var completer = StreamCompleter(); + var completer = StreamCompleter(); late StreamController controller; controller = StreamController(onListen: () { scheduleMicrotask(controller.close); @@ -208,7 +208,7 @@ void main() { }); test('linking a stream after setSourceStream before listen', () async { - var completer = StreamCompleter(); + var completer = StreamCompleter(); completer.setSourceStream(createStream()); expect(() => completer.setSourceStream(createStream()), throwsStateError); expect(() => completer.setEmpty(), throwsStateError); @@ -219,7 +219,7 @@ void main() { }); test('linking a stream after setSourceStream after listen', () async { - var completer = StreamCompleter(); + var completer = StreamCompleter(); var list = completer.stream.toList(); completer.setSourceStream(createStream()); expect(() => completer.setSourceStream(createStream()), throwsStateError); @@ -231,7 +231,7 @@ void main() { }); test('linking a stream after setEmpty before listen', () async { - var completer = StreamCompleter(); + var completer = StreamCompleter(); completer.setEmpty(); expect(() => completer.setSourceStream(createStream()), throwsStateError); expect(() => completer.setEmpty(), throwsStateError); @@ -242,7 +242,7 @@ void main() { }); test('linking a stream after setEmpty() after listen', () async { - var completer = StreamCompleter(); + var completer = StreamCompleter(); var list = completer.stream.toList(); completer.setEmpty(); expect(() => completer.setSourceStream(createStream()), throwsStateError); @@ -254,7 +254,7 @@ void main() { }); test('listening more than once after setting stream', () async { - var completer = StreamCompleter(); + var completer = StreamCompleter(); completer.setSourceStream(createStream()); var list = completer.stream.toList(); expect(() => completer.stream.toList(), throwsStateError); @@ -263,7 +263,7 @@ void main() { }); test('listening more than once before setting stream', () async { - var completer = StreamCompleter(); + var completer = StreamCompleter(); completer.stream.toList(); expect(() => completer.stream.toList(), throwsStateError); }); @@ -298,8 +298,8 @@ void main() { }); test('pause w/ resume future accross setting stream', () async { - var completer = StreamCompleter(); - var resume = Completer(); + var completer = StreamCompleter(); + var resume = Completer(); var subscription = completer.stream.listen(unreachable('data')); subscription.pause(resume.future); await flushMicrotasks(); @@ -313,8 +313,8 @@ void main() { }); test('asFuture with error accross setting stream', () async { - var completer = StreamCompleter(); - var controller = StreamController(); + var completer = StreamCompleter(); + var controller = StreamController(); var subscription = completer.stream.listen(unreachable('data'), cancelOnError: false); var done = subscription.asFuture(); @@ -331,7 +331,7 @@ void main() { group('setError()', () { test('produces a stream that emits a single error', () { - var completer = StreamCompleter(); + var completer = StreamCompleter(); completer.stream.listen(unreachable('data'), onError: expectAsync2((error, stackTrace) { expect(error, equals('oh no')); @@ -342,7 +342,7 @@ void main() { test('produces a stream that emits a single error on a later listen', () async { - var completer = StreamCompleter(); + var completer = StreamCompleter(); completer.setError('oh no'); await flushMicrotasks(); diff --git a/test/stream_group_test.dart b/test/stream_group_test.dart index 5c684f3..3700120 100644 --- a/test/stream_group_test.dart +++ b/test/stream_group_test.dart @@ -162,7 +162,7 @@ void main() { test('forwards a cancel future', () async { var subscription = streamGroup.stream.listen(null); - var completer = Completer(); + var completer = Completer(); var controller = StreamController(onCancel: () => completer.future); streamGroup.add(controller.stream); @@ -231,7 +231,7 @@ void main() { }); test('forwards a cancel future', () async { - var completer = Completer(); + var completer = Completer(); var controller = StreamController(onCancel: () => completer.future); @@ -680,7 +680,7 @@ void regardlessOfType(StreamGroup Function() newStreamGroup) { }); test('forwards cancel futures', () async { - var completer = Completer(); + var completer = Completer(); var controller = StreamController(onCancel: () => completer.future); @@ -923,4 +923,4 @@ void regardlessOfType(StreamGroup Function() newStreamGroup) { } /// Wait for all microtasks to complete. -Future flushMicrotasks() => Future.delayed(Duration.zero); +Future flushMicrotasks() => Future.delayed(Duration.zero); diff --git a/test/stream_queue_test.dart b/test/stream_queue_test.dart index 5e5ad41..cd4433a 100644 --- a/test/stream_queue_test.dart +++ b/test/stream_queue_test.dart @@ -391,7 +391,7 @@ void main() { }); test('forwards to underlying stream', () async { - var cancel = Completer(); + var cancel = Completer(); var controller = StreamController(onCancel: () => cancel.future); var events = StreamQueue(controller.stream); expect(controller.hasListener, isFalse); @@ -873,7 +873,7 @@ void main() { // Regression test. test('pending child rest requests emit no more events', () async { - var controller = StreamController(); + var controller = StreamController(); var events = StreamQueue(controller.stream); var transaction = events.startTransaction(); var queue = transaction.newQueue(); @@ -907,7 +907,7 @@ void main() { }); test('before the transaction emits any events, does nothing', () async { - var controller = StreamController(); + var controller = StreamController(); var events = StreamQueue(controller.stream); // Queue a request before the transaction, but don't let it complete @@ -1003,7 +1003,7 @@ void main() { }); test('before the transaction emits any events, does nothing', () async { - var controller = StreamController(); + var controller = StreamController(); var events = StreamQueue(controller.stream); // Queue a request before the transaction, but don't let it complete diff --git a/test/stream_sink_completer_test.dart b/test/stream_sink_completer_test.dart index 11592bb..e00ecc8 100644 --- a/test/stream_sink_completer_test.dart +++ b/test/stream_sink_completer_test.dart @@ -12,7 +12,7 @@ import 'utils.dart'; void main() { late StreamSinkCompleter completer; setUp(() { - completer = StreamSinkCompleter(); + completer = StreamSinkCompleter(); }); group('when a stream is linked before events are added', () { @@ -46,7 +46,7 @@ void main() { var sink = TestSink(); completer.setDestinationSink(sink); - var controller = StreamController(); + var controller = StreamController(); completer.sink.addStream(controller.stream); controller.add(1); @@ -74,7 +74,7 @@ void main() { }); test('the future from the inner close() is returned', () async { - var closeCompleter = Completer(); + var closeCompleter = Completer(); var sink = TestSink(onDone: () => closeCompleter.future); completer.setDestinationSink(sink); @@ -152,7 +152,7 @@ void main() { }); test('addStream is forwarded', () async { - var controller = StreamController(); + var controller = StreamController(); completer.sink.addStream(controller.stream); controller.add(1); @@ -191,7 +191,7 @@ void main() { })); await flushMicrotasks(); - var closeCompleter = Completer(); + var closeCompleter = Completer(); var sink = TestSink(onDone: () => closeCompleter.future); completer.setDestinationSink(sink); await flushMicrotasks(); diff --git a/test/stream_sink_transformer_test.dart b/test/stream_sink_transformer_test.dart index 905e713..caea349 100644 --- a/test/stream_sink_transformer_test.dart +++ b/test/stream_sink_transformer_test.dart @@ -12,7 +12,7 @@ import 'utils.dart'; void main() { late StreamController controller; setUp(() { - controller = StreamController(); + controller = StreamController(); }); group('fromStreamTransformer', () { diff --git a/test/stream_splitter_test.dart b/test/stream_splitter_test.dart index 43fe392..27921db 100644 --- a/test/stream_splitter_test.dart +++ b/test/stream_splitter_test.dart @@ -287,4 +287,4 @@ void main() { } /// Wait for all microtasks to complete. -Future flushMicrotasks() => Future.delayed(Duration.zero); +Future flushMicrotasks() => Future.delayed(Duration.zero); diff --git a/test/stream_zip_test.dart b/test/stream_zip_test.dart index 71ce2c4..147d419 100644 --- a/test/stream_zip_test.dart +++ b/test/stream_zip_test.dart @@ -225,7 +225,7 @@ void main() { }); test('Error after first end', () { - var controller = StreamController(); + var controller = StreamController(); controller ..add(7) ..add(8) @@ -289,7 +289,7 @@ void main() { }).then((hasMore) { expect(hasMore, isTrue); expect(it.current, equals([5, 6])); - Future.delayed(ms25).then((_) { + Future.delayed(ms25).then((_) { c2.add(8); }); return it.moveNext(); @@ -323,10 +323,10 @@ void main() { sub = sz.listen(expectAsync1((v) { expect(v, equals([ctr * 2, ctr * 2 + 1])); if (ctr == 1) { - sub.pause(Future.delayed(const Duration(milliseconds: 25))); + sub.pause(Future.delayed(const Duration(milliseconds: 25))); } else if (ctr == 2) { sub.pause(); - Future.delayed(const Duration(milliseconds: 25)).then((_) { + Future.delayed(const Duration(milliseconds: 25)).then((_) { sub.resume(); }); } diff --git a/test/stream_zip_zone_test.dart b/test/stream_zip_zone_test.dart index 50af6b6..a18c776 100644 --- a/test/stream_zip_zone_test.dart +++ b/test/stream_zip_zone_test.dart @@ -11,11 +11,11 @@ import 'package:test/test.dart'; void main() { StreamController controller; - controller = StreamController(); + controller = StreamController(); testStream('singlesub-async', controller, controller.stream); controller = StreamController.broadcast(); testStream('broadcast-async', controller, controller.stream); - controller = StreamController(); + controller = StreamController(); testStream( 'asbroadcast-async', controller, controller.stream.asBroadcastStream()); diff --git a/test/subscription_stream_test.dart b/test/subscription_stream_test.dart index a825c25..0d245f3 100644 --- a/test/subscription_stream_test.dart +++ b/test/subscription_stream_test.dart @@ -76,7 +76,7 @@ void main() { late Future onCancel; // Completes if source stream is canceled before done. setUp(() { - var cancelCompleter = Completer(); + var cancelCompleter = Completer(); var source = createErrorStream(cancelCompleter); onCancel = cancelCompleter.future; var sourceSubscription = @@ -85,7 +85,7 @@ void main() { }); test('- subscriptionStream: no', () async { - var done = Completer(); + var done = Completer(); var events = []; subscriptionStream.listen(events.add, onError: events.add, onDone: done.complete, cancelOnError: false); @@ -97,7 +97,7 @@ void main() { done.future.then((_) { isDone = true; }); - await Future.delayed(const Duration(milliseconds: 5)); + await Future.delayed(const Duration(milliseconds: 5)); expect(isDone, false); } else { expected.add(4); @@ -107,7 +107,7 @@ void main() { }); test('- subscriptionStream: yes', () async { - var completer = Completer(); + var completer = Completer(); var events = []; subscriptionStream.listen(events.add, onError: (Object? value) { diff --git a/test/subscription_transformer_test.dart b/test/subscription_transformer_test.dart index a95c7c4..53610e1 100644 --- a/test/subscription_transformer_test.dart +++ b/test/subscription_transformer_test.dart @@ -41,7 +41,7 @@ void main() { }); test('forwards pausing and resuming', () async { - var controller = StreamController(); + var controller = StreamController(); var subscription = controller.stream .transform(subscriptionTransformer()) .listen(expectAsync1((_) {}, count: 0)); @@ -64,12 +64,12 @@ void main() { }); test('forwards pausing with a resume future', () async { - var controller = StreamController(); + var controller = StreamController(); var subscription = controller.stream .transform(subscriptionTransformer()) .listen(expectAsync1((_) {}, count: 0)); - var completer = Completer(); + var completer = Completer(); subscription.pause(completer.future); await flushMicrotasks(); expect(controller.isPaused, isTrue); @@ -105,8 +105,8 @@ void main() { }); test('invokes the callback once and caches its result', () async { - var completer = Completer(); - var controller = StreamController(); + var completer = Completer(); + var controller = StreamController(); var subscription = controller.stream .transform(subscriptionTransformer( handleCancel: expectAsync1((inner) => completer.future))) @@ -136,7 +136,7 @@ void main() { group('with a pause callback', () { test('invokes the callback when pause is called', () async { var pauseCount = 0; - var controller = StreamController(); + var controller = StreamController(); var subscription = controller.stream .transform(subscriptionTransformer( handlePause: expectAsync1((inner) { @@ -168,7 +168,7 @@ void main() { test("doesn't invoke the callback when the subscription has been canceled", () async { - var controller = StreamController(); + var controller = StreamController(); var subscription = controller.stream .transform(subscriptionTransformer( handlePause: expectAsync1((_) {}, count: 0))) @@ -184,7 +184,7 @@ void main() { group('with a resume callback', () { test('invokes the callback when resume is called', () async { var resumeCount = 0; - var controller = StreamController(); + var controller = StreamController(); var subscription = controller.stream .transform(subscriptionTransformer( handleResume: expectAsync1((inner) { @@ -216,14 +216,14 @@ void main() { test('invokes the callback when a resume future completes', () async { var resumed = false; - var controller = StreamController(); + var controller = StreamController(); var subscription = controller.stream.transform( subscriptionTransformer(handleResume: expectAsync1((inner) { resumed = true; inner.resume(); }))).listen(expectAsync1((_) {}, count: 0)); - var completer = Completer(); + var completer = Completer(); subscription.pause(completer.future); await flushMicrotasks(); expect(resumed, isFalse); @@ -235,7 +235,7 @@ void main() { test("doesn't invoke the callback when the subscription has been canceled", () async { - var controller = StreamController(); + var controller = StreamController(); var subscription = controller.stream .transform(subscriptionTransformer( handlePause: expectAsync1((_) {}, count: 0))) @@ -251,7 +251,7 @@ void main() { group('when the outer subscription is canceled but the inner is not', () { late StreamSubscription subscription; setUp(() { - var controller = StreamController(); + var controller = StreamController(); subscription = controller.stream .transform( subscriptionTransformer(handleCancel: (_) => Future.value())) diff --git a/test/utils.dart b/test/utils.dart index d2d9fe6..0a6b339 100644 --- a/test/utils.dart +++ b/test/utils.dart @@ -11,7 +11,7 @@ import 'package:async/async.dart'; import 'package:test/test.dart'; /// A zero-millisecond timer should wait until after all microtasks. -Future flushMicrotasks() => Future.delayed(Duration.zero); +Future flushMicrotasks() => Future.delayed(Duration.zero); typedef OptionalArgAction = void Function([dynamic a, dynamic b]); @@ -62,7 +62,7 @@ class UnusableStream extends Stream { /// The [completer] field allows the user to control the future returned by /// [done] and [close]. class CompleterStreamSink implements StreamSink { - final completer = Completer(); + final completer = Completer(); @override Future get done => completer.future; @@ -90,7 +90,7 @@ class TestSink implements StreamSink { @override Future get done => _doneCompleter.future; - final _doneCompleter = Completer(); + final _doneCompleter = Completer(); final void Function() _onDone; From a5033913f6b98982589e5c0159c0edbcb86059ff Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Tue, 13 Feb 2024 12:08:26 -0800 Subject: [PATCH 3/3] oops --- test/stream_completer_test.dart | 2 +- test/stream_sink_completer_test.dart | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/stream_completer_test.dart b/test/stream_completer_test.dart index 3db28a9..f58162e 100644 --- a/test/stream_completer_test.dart +++ b/test/stream_completer_test.dart @@ -38,7 +38,7 @@ void main() { var subscription = controller.stream.listen(events.add); var done = subscription.asFuture(); subscription.pause(); - var sourceController = StreamController(); + var sourceController = StreamController(); sourceController ..add(1) ..add(2) diff --git a/test/stream_sink_completer_test.dart b/test/stream_sink_completer_test.dart index e00ecc8..3a6f25b 100644 --- a/test/stream_sink_completer_test.dart +++ b/test/stream_sink_completer_test.dart @@ -46,7 +46,7 @@ void main() { var sink = TestSink(); completer.setDestinationSink(sink); - var controller = StreamController(); + var controller = StreamController(); completer.sink.addStream(controller.stream); controller.add(1); @@ -152,7 +152,7 @@ void main() { }); test('addStream is forwarded', () async { - var controller = StreamController(); + var controller = StreamController(); completer.sink.addStream(controller.stream); controller.add(1);