Fix newly enforced package:pedantic lints (dart-lang/stream_transform#96)
- always_declare_return_types
- use_function_type_syntax_for_parameters
diff --git a/pkgs/stream_transform/lib/src/aggregate_sample.dart b/pkgs/stream_transform/lib/src/aggregate_sample.dart
index a069af7..5ddeb10 100644
--- a/pkgs/stream_transform/lib/src/aggregate_sample.dart
+++ b/pkgs/stream_transform/lib/src/aggregate_sample.dart
@@ -32,13 +32,13 @@
StreamSubscription<S> valueSub;
StreamSubscription<void> triggerSub;
- emit() {
+ void emit() {
controller.add(currentResults);
currentResults = null;
waitingForTrigger = true;
}
- onValue(S value) {
+ void onValue(S value) {
currentResults = _aggregate(value, currentResults);
if (!waitingForTrigger) emit();
@@ -49,7 +49,7 @@
}
}
- onValuesDone() {
+ void onValuesDone() {
isValueDone = true;
if (currentResults == null) {
triggerSub?.cancel();
@@ -57,7 +57,7 @@
}
}
- onTrigger(_) {
+ void onTrigger(_) {
waitingForTrigger = false;
if (currentResults != null) emit();
@@ -68,7 +68,7 @@
}
}
- onTriggerDone() {
+ void onTriggerDone() {
isTriggerDone = true;
if (waitingForTrigger) {
valueSub?.cancel();
diff --git a/pkgs/stream_transform/lib/src/async_map.dart b/pkgs/stream_transform/lib/src/async_map.dart
index f002667..c5b160b 100644
--- a/pkgs/stream_transform/lib/src/async_map.dart
+++ b/pkgs/stream_transform/lib/src/async_map.dart
@@ -89,7 +89,7 @@
///
/// The result stream will not close until the source stream closes and all
/// pending conversions have finished.
- Stream<S> concurrentAsyncMap<S>(FutureOr<S> convert(T event)) {
+ Stream<S> concurrentAsyncMap<S>(FutureOr<S> Function(T) convert) {
var valuesWaiting = 0;
var sourceDone = false;
return transform(fromHandlers(handleData: (element, sink) {
@@ -116,7 +116,7 @@
/// rather than once per listener, and [then] is called after completing the
/// work.
StreamTransformer<S, T> _asyncMapThen<S, T>(
- Future<T> convert(S event), void Function(void) then) {
+ Future<T> Function(S) convert, void Function(void) then) {
Future<void> pendingEvent;
return fromHandlers(handleData: (event, sink) {
pendingEvent =
diff --git a/pkgs/stream_transform/lib/src/concatenate.dart b/pkgs/stream_transform/lib/src/concatenate.dart
index f9ba747..05c977f 100644
--- a/pkgs/stream_transform/lib/src/concatenate.dart
+++ b/pkgs/stream_transform/lib/src/concatenate.dart
@@ -75,17 +75,17 @@
Function currentDoneHandler;
- listen() {
+ void listen() {
subscription = currentStream.listen(controller.add,
onError: controller.addError, onDone: () => currentDoneHandler());
}
- onSecondDone() {
+ void onSecondDone() {
secondDone = true;
controller.close();
}
- onFirstDone() {
+ void onFirstDone() {
firstDone = true;
currentStream = next;
currentDoneHandler = onSecondDone;
diff --git a/pkgs/stream_transform/lib/src/rate_limit.dart b/pkgs/stream_transform/lib/src/rate_limit.dart
index db6d7df..15078b7 100644
--- a/pkgs/stream_transform/lib/src/rate_limit.dart
+++ b/pkgs/stream_transform/lib/src/rate_limit.dart
@@ -146,7 +146,7 @@
/// Creates a StreamTransformer which aggregates values until the source stream
/// does not emit for [duration], then emits the aggregated values.
StreamTransformer<T, R> _debounceAggregate<T, R>(
- Duration duration, R collect(T element, R soFar)) {
+ Duration duration, R Function(T element, R soFar) collect) {
Timer timer;
R soFar;
var shouldClose = false;
diff --git a/pkgs/stream_transform/lib/src/scan.dart b/pkgs/stream_transform/lib/src/scan.dart
index b31b9e7..4e022f5 100644
--- a/pkgs/stream_transform/lib/src/scan.dart
+++ b/pkgs/stream_transform/lib/src/scan.dart
@@ -14,7 +14,7 @@
/// called for elements in order, and the result stream always maintains the
/// same order as the original.
Stream<S> scan<S>(
- S initialValue, FutureOr<S> combine(S previousValue, T element)) {
+ S initialValue, FutureOr<S> Function(S soFar, T element) combine) {
var accumulated = initialValue;
return asyncMap((value) {
var result = combine(accumulated, value);
diff --git a/pkgs/stream_transform/lib/src/switch.dart b/pkgs/stream_transform/lib/src/switch.dart
index 2e2aeba..b30556a 100644
--- a/pkgs/stream_transform/lib/src/switch.dart
+++ b/pkgs/stream_transform/lib/src/switch.dart
@@ -15,7 +15,7 @@
///
/// If the source stream is a broadcast stream, the result stream will be as
/// well, regardless of the types of the streams produced by [convert].
- Stream<S> switchMap<S>(Stream<S> convert(T event)) {
+ Stream<S> switchMap<S>(Stream<S> Function(T) convert) {
return map(convert).switchLatest();
}
}
diff --git a/pkgs/stream_transform/lib/src/where.dart b/pkgs/stream_transform/lib/src/where.dart
index 7026923..850e9a9 100644
--- a/pkgs/stream_transform/lib/src/where.dart
+++ b/pkgs/stream_transform/lib/src/where.dart
@@ -34,7 +34,7 @@
///
/// The result stream will not close until the source stream closes and all
/// pending [test] calls have finished.
- Stream<T> asyncWhere(FutureOr<bool> test(T element)) {
+ Stream<T> asyncWhere(FutureOr<bool> Function(T) test) {
var valuesWaiting = 0;
var sourceDone = false;
return transform(fromHandlers(handleData: (element, sink) {
diff --git a/pkgs/stream_transform/pubspec.yaml b/pkgs/stream_transform/pubspec.yaml
index 5ad672b..1c8d88e 100644
--- a/pkgs/stream_transform/pubspec.yaml
+++ b/pkgs/stream_transform/pubspec.yaml
@@ -1,7 +1,7 @@
name: stream_transform
description: A collection of utilities to transform and manipulate streams.
homepage: https://www.github.com/dart-lang/stream_transform
-version: 1.1.0
+version: 1.1.1-dev
environment:
sdk: ">=2.6.0 <3.0.0"
diff --git a/pkgs/stream_transform/test/start_with_test.dart b/pkgs/stream_transform/test/start_with_test.dart
index 3208903..3a5a025 100644
--- a/pkgs/stream_transform/test/start_with_test.dart
+++ b/pkgs/stream_transform/test/start_with_test.dart
@@ -18,7 +18,7 @@
List<int> emittedValues;
bool isDone;
- setupForStreamType(
+ void setupForStreamType(
String streamType, Stream<int> Function(Stream<int>) transform) {
emittedValues = [];
isDone = false;