Drop non-extension methods (dart-lang/stream_transform#88)
Prepare to publish as `1.0.0` with only the extension method
implementations. All deprecated methods are removed.
Temporarily drop build_runner. It was only for the example and
doesn't have a constraint allowing a breaking change in this
package.
diff --git a/pkgs/stream_transform/CHANGELOG.md b/pkgs/stream_transform/CHANGELOG.md
index d9b0049..99d2786 100644
--- a/pkgs/stream_transform/CHANGELOG.md
+++ b/pkgs/stream_transform/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.0.0
+
+- Remove the top level methods and retain the extensions only.
+
## 0.0.20
- Add extension methods for most transformers. These should be used in place
diff --git a/pkgs/stream_transform/lib/src/async_map.dart b/pkgs/stream_transform/lib/src/async_map.dart
index c9b263f..464e497 100644
--- a/pkgs/stream_transform/lib/src/async_map.dart
+++ b/pkgs/stream_transform/lib/src/async_map.dart
@@ -5,7 +5,6 @@
import 'dart:async';
import 'aggregate_sample.dart';
-import 'chain_transformers.dart';
import 'from_handlers.dart';
import 'rate_limit.dart';
@@ -112,62 +111,6 @@
}
}
-/// Like [Stream.asyncMap] but events are buffered until previous events have
-/// been processed by [convert].
-///
-/// If the source stream is a broadcast stream the result will be as well. When
-/// used with a broadcast stream behavior also differs from [Stream.asyncMap] in
-/// that the [convert] function is only called once per event, rather than once
-/// per listener per event.
-///
-/// The first event from the source stream is always passed to [convert] as a
-/// List with a single element. After that events are buffered until the
-/// previous Future returned from [convert] has fired.
-///
-/// Errors from the source stream are forwarded directly to the result stream.
-/// Errors during the conversion are also forwarded to the result stream and are
-/// considered completing work so the next values are let through.
-///
-/// The result stream will not close until the source stream closes and all
-/// pending conversions have finished.
-@Deprecated('Use the extension instead')
-StreamTransformer<S, T> asyncMapBuffer<S, T>(
- Future<T> Function(List<S>) convert) {
- var workFinished = StreamController<void>()
- // Let the first event through.
- ..add(null);
- return chainTransformers(
- buffer(workFinished.stream), _asyncMapThen(convert, workFinished.add));
-}
-
-/// Like [Stream.asyncMap] but events are discarded while work is happening in
-/// [convert].
-///
-/// If the source stream is a broadcast stream the result will be as well. When
-/// used with a broadcast stream behavior also differs from [Stream.asyncMap] in
-/// that the [convert] function is only called once per event, rather than once
-/// per listener per event.
-///
-/// If no work is happening when an event is emitted it will be immediately
-/// passed to [convert]. If there is ongoing work when an event is emitted it
-/// will be held until the work is finished. New events emitted will replace a
-/// pending event.
-///
-/// Errors from the source stream are forwarded directly to the result stream.
-/// Errors during the conversion are also forwarded to the result stream and are
-/// considered completing work so the next values are let through.
-///
-/// The result stream will not close until the source stream closes and all
-/// pending conversions have finished.
-@Deprecated('Use the extension instead')
-StreamTransformer<S, T> asyncMapSample<S, T>(Future<T> Function(S) convert) {
- var workFinished = StreamController<void>()
- // Let the first event through.
- ..add(null);
- return chainTransformers(AggregateSample(workFinished.stream, _dropPrevious),
- _asyncMapThen(convert, workFinished.add));
-}
-
T _dropPrevious<T>(T event, _) => event;
/// Like [Stream.asyncMap] but the [convert] is only called once per event,
@@ -187,41 +130,3 @@
}
});
}
-
-/// Like [Stream.asyncMap] but the [convert] callback may be called for an
-/// element before processing for the previous element is finished.
-///
-/// Events on the result stream will be emitted in the order that [convert]
-/// completed which may not match the order of the original stream.
-///
-/// If the source stream is a broadcast stream the result will be as well. When
-/// used with a broadcast stream behavior also differs from [Stream.asyncMap] in
-/// that the [convert] function is only called once per event, rather than once
-/// per listener per event. The [convert] callback won't be called for events
-/// while a broadcast stream has no listener.
-///
-/// Errors from the source stream are forwarded directly to the result stream.
-/// Errors during the conversion are also forwarded to the result stream.
-///
-/// The result stream will not close until the source stream closes and all
-/// pending conversions have finished.
-@Deprecated('Use the extension instead')
-StreamTransformer<S, T> concurrentAsyncMap<S, T>(FutureOr<T> convert(S event)) {
- var valuesWaiting = 0;
- var sourceDone = false;
- return fromHandlers(handleData: (element, sink) {
- valuesWaiting++;
- () async {
- try {
- sink.add(await convert(element));
- } catch (e, st) {
- sink.addError(e, st);
- }
- valuesWaiting--;
- if (valuesWaiting <= 0 && sourceDone) sink.close();
- }();
- }, handleDone: (sink) {
- sourceDone = true;
- if (valuesWaiting <= 0) sink.close();
- });
-}
diff --git a/pkgs/stream_transform/lib/src/chain_transformers.dart b/pkgs/stream_transform/lib/src/chain_transformers.dart
deleted file mode 100644
index 1e812d9..0000000
--- a/pkgs/stream_transform/lib/src/chain_transformers.dart
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
-// 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.
-
-import 'dart:async';
-
-/// Combines two transformers into one.
-///
-/// This is most useful to keep a reference to the combination and use it in
-/// multiple places or give it a descriptive name. For inline uses the directly
-/// chained calls to `.transform` should be preferred.
-///
-/// For example:
-///
-/// ```
-/// /// values.transform(splitDecoded) is identical to
-/// /// values.transform(utf8.decoder).transform(const LineSplitter())
-/// final splitDecoded = chainTransformers(utf8.decoder, const LineSplitter());
-/// ```
-@Deprecated('This utility should not be needed with extension methods')
-StreamTransformer<S, T> chainTransformers<S, I, T>(
- StreamTransformer<S, I> first, StreamTransformer<I, T> second) =>
- StreamTransformer.fromBind(
- (values) => values.transform(first).transform(second));
diff --git a/pkgs/stream_transform/lib/src/combine_latest.dart b/pkgs/stream_transform/lib/src/combine_latest.dart
index 4e35997..bacc7d6 100644
--- a/pkgs/stream_transform/lib/src/combine_latest.dart
+++ b/pkgs/stream_transform/lib/src/combine_latest.dart
@@ -76,38 +76,6 @@
transform(_CombineLatestAll<T>(others));
}
-/// Combine the latest value from the source stream with the latest value from
-/// [other] using [combine].
-///
-/// No event will be emitted from the result stream until both the source stream
-/// and [other] have each emitted at least one event. Once both streams have
-/// emitted at least one event, the result stream will emit any time either
-/// input stream emits.
-///
-/// For example:
-/// source.transform(combineLatest(other, (a, b) => a + b));
-///
-/// source:
-/// 1--2-----4
-/// other:
-/// ------3---
-/// result:
-/// ------5--7
-///
-/// The result stream will not close until both the source stream and [other]
-/// have closed.
-///
-/// Errors thrown by [combine], along with any errors on the source stream or
-/// [other], are forwarded to the result stream.
-///
-/// If the source stream is a broadcast stream, the result stream will be as
-/// well, regardless of [other]'s type. If a single subscription stream is
-/// combined with a broadcast stream it may never be canceled.
-@Deprecated('Use the extension instead')
-StreamTransformer<S, R> combineLatest<S, T, R>(
- Stream<T> other, FutureOr<R> Function(S, T) combine) =>
- _CombineLatest(other, combine);
-
class _CombineLatest<S, T, R> extends StreamTransformerBase<S, R> {
final Stream<T> _other;
final FutureOr<R> Function(S, T) _combine;
@@ -218,45 +186,6 @@
}
}
-/// Combine the latest value emitted from the source stream with the latest
-/// values emitted from [others].
-///
-/// [combineLatestAll] subscribes to the source stream and [others] and when
-/// any one of the streams emits, the result stream will emit a [List<T>] of
-/// the latest values emitted from all streams.
-///
-/// The result stream will not emit until all source streams emit at least
-/// once. If a source stream emits multiple values before another starts
-/// emitting, all but the last value will be lost.
-///
-/// The result stream will not close until all source streams have closed. When
-/// a source stream closes, the result stream will continue to emit the last
-/// value from the closed stream when the other source streams emit until the
-/// result stream has closed. If a source stream closes without emitting any
-/// value, the result stream will close as well.
-///
-/// Errors thrown by any source stream will be forwarded to the result stream.
-///
-/// If the source stream is a broadcast stream, the result stream will be as
-/// well, regardless of the types of [others]. If a single subscription stream
-/// is combined with a broadcast source stream, it may never be canceled.
-///
-/// ## Example
-///
-/// (Suppose first, second, and third are Stream<String>)
-/// final combined = first
-/// .transform(combineLatestAll([second, third]))
-/// .map((data) => data.join());
-///
-/// first: a----b------------------c--------d---|
-/// second: --1---------2-----------------|
-/// third: -------&----------%---|
-/// combined: -------b1&--b2&---b2%---c2%------d2%-|
-///
-@Deprecated('Use the extension instead')
-StreamTransformer<T, List<T>> combineLatestAll<T>(Iterable<Stream<T>> others) =>
- _CombineLatestAll<T>(others);
-
class _CombineLatestAll<T> extends StreamTransformerBase<T, List<T>> {
final Iterable<Stream<T>> _others;
diff --git a/pkgs/stream_transform/lib/src/concatenate.dart b/pkgs/stream_transform/lib/src/concatenate.dart
index 402a4bc..f9ba747 100644
--- a/pkgs/stream_transform/lib/src/concatenate.dart
+++ b/pkgs/stream_transform/lib/src/concatenate.dart
@@ -53,21 +53,6 @@
}
}
-/// Starts emitting values from [next] after the original stream is complete.
-///
-/// If the initial stream never finishes, the [next] stream will never be
-/// listened to.
-///
-/// If a single-subscription follows the a broadcast stream it may be listened
-/// to and never canceled.
-///
-/// If a broadcast stream follows any other stream it will miss any events which
-/// occur before the first stream is done. If a broadcast stream follows a
-/// single-subscription stream, pausing the stream while it is listening to the
-/// second stream will cause events to be dropped rather than buffered.
-@Deprecated('Use the extension instead')
-StreamTransformer<T, T> followedBy<T>(Stream<T> next) => _FollowedBy<T>(next);
-
class _FollowedBy<T> extends StreamTransformerBase<T, T> {
final Stream<T> _next;
@@ -134,36 +119,3 @@
return controller.stream;
}
}
-
-/// Emits [initial] before any values from the original stream.
-///
-/// If the original stream is a broadcast stream the result will be as well.
-@Deprecated('Use the extension instead')
-StreamTransformer<T, T> startWith<T>(T initial) =>
- startWithStream<T>(Future.value(initial).asStream());
-
-/// Emits all values in [initial] before any values from the original stream.
-///
-/// If the original stream is a broadcast stream the result will be as well. If
-/// the original stream is a broadcast stream it will miss any events which
-/// occur before the initial values are all emitted.
-@Deprecated('Use the extension instead')
-StreamTransformer<T, T> startWithMany<T>(Iterable<T> initial) =>
- startWithStream<T>(Stream.fromIterable(initial));
-
-/// Emits all values in [initial] before any values from the original stream.
-///
-/// If the original stream is a broadcast stream the result will be as well. If
-/// the original stream is a broadcast stream it will miss any events which
-/// occur before [initial] closes.
-@Deprecated('Use the extension instead')
-StreamTransformer<T, T> startWithStream<T>(Stream<T> initial) =>
- StreamTransformer.fromBind((values) {
- if (values.isBroadcast && !initial.isBroadcast) {
- initial = initial.asBroadcastStream();
- }
- return initial.transform(followedBy(values));
- });
-
-@Deprecated('Use followedBy instead')
-StreamTransformer<T, T> concat<T>(Stream<T> next) => followedBy<T>(next);
diff --git a/pkgs/stream_transform/lib/src/map.dart b/pkgs/stream_transform/lib/src/map.dart
deleted file mode 100644
index e1f7137..0000000
--- a/pkgs/stream_transform/lib/src/map.dart
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
-// 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.
-
-import 'dart:async';
-
-/// Models a [Stream.map] callback as a [StreamTransformer].
-///
-/// This is most useful to pass to functions that take a [StreamTransformer]
-/// other than [Stream.transform]. For inline uses [Stream.map] should be
-/// preferred.
-///
-/// For example:
-///
-/// ```
-/// final sinkMapper = new StreamSinkTransformer.fromStreamTransformer(
-/// map((v) => '$v'));
-/// ```
-@Deprecated('This utility should not be needed with extension methods')
-StreamTransformer<S, T> map<S, T>(T convert(S event)) =>
- StreamTransformer.fromBind((stream) => stream.map(convert));
diff --git a/pkgs/stream_transform/lib/src/merge.dart b/pkgs/stream_transform/lib/src/merge.dart
index 736cde5..bbcf759 100644
--- a/pkgs/stream_transform/lib/src/merge.dart
+++ b/pkgs/stream_transform/lib/src/merge.dart
@@ -56,25 +56,6 @@
Stream<T> mergeAll(Iterable<Stream<T>> others) => transform(_Merge(others));
}
-/// Emits values from the source stream and [other] in any order as they arrive.
-///
-/// If the source stream is a broadcast stream, the result stream will be as
-/// well, regardless of [other]'s type. If a single subscription stream is
-/// merged into a broadcast stream it may never be canceled.
-@Deprecated('Use the extension instead')
-StreamTransformer<T, T> merge<T>(Stream<T> other) => _Merge<T>([other]);
-
-/// Emits values from the source stream and all streams in [others] in any order
-/// as they arrive.
-///
-/// If the source stream is a broadcast stream, the result stream will be as
-/// well, regardless of the types of streams in [others]. If single
-/// subscription streams are merged into a broadcast stream they may never be
-/// canceled.
-@Deprecated('Use the extension instead')
-StreamTransformer<T, T> mergeAll<T>(Iterable<Stream<T>> others) =>
- _Merge<T>(others);
-
class _Merge<T> extends StreamTransformerBase<T, T> {
final Iterable<Stream<T>> _others;
diff --git a/pkgs/stream_transform/lib/src/rate_limit.dart b/pkgs/stream_transform/lib/src/rate_limit.dart
index 91a7648..db6d7df 100644
--- a/pkgs/stream_transform/lib/src/rate_limit.dart
+++ b/pkgs/stream_transform/lib/src/rate_limit.dart
@@ -135,25 +135,6 @@
transform(AggregateSample<T, List<T>>(trigger, _collect));
}
-/// Creates a StreamTransformer which only emits when the source stream does not
-/// emit for [duration].
-///
-/// Source values will always be delayed by at least [duration], and values
-/// which come within this time will replace the old values, only the most
-/// recent value will be emitted.
-@Deprecated('Use the extension instead')
-StreamTransformer<T, T> debounce<T>(Duration duration) =>
- _debounceAggregate(duration, _dropPrevious);
-
-/// Creates a StreamTransformer which collects values until the source stream
-/// does not emit for [duration] then emits the collected values.
-///
-/// This differs from [debounce] in that values are aggregated instead of
-/// skipped.
-@Deprecated('Use the extension instead')
-StreamTransformer<T, List<T>> debounceBuffer<T>(Duration duration) =>
- _debounceAggregate(duration, _collectToList);
-
List<T> _collectToList<T>(T element, List<T> soFar) {
soFar ??= <T>[];
soFar.add(element);
@@ -189,68 +170,4 @@
});
}
-/// Creates a StreamTransformer which only emits once per [duration], at the
-/// beginning of the period.
-@Deprecated('Use the extension instead')
-StreamTransformer<T, T> throttle<T>(Duration duration) {
- Timer timer;
-
- return fromHandlers(handleData: (data, sink) {
- if (timer == null) {
- sink.add(data);
- timer = Timer(duration, () {
- timer = null;
- });
- }
- });
-}
-
-/// Creates a StreamTransformer which only emits once per [duration], at the
-/// end of the period.
-///
-/// Always introduces a delay of at most [duration].
-///
-/// Differs from `throttle` in that it always emits the most recently received
-/// event rather than the first in the period.
-///
-/// Differs from `debounce` in that a value will always be emitted after
-/// [duration], the output will not be starved by values coming in repeatedly
-/// within [duration].
-@Deprecated('Use the extension instead')
-StreamTransformer<T, T> audit<T>(Duration duration) {
- Timer timer;
- var shouldClose = false;
- T recentData;
-
- return fromHandlers(handleData: (T data, EventSink<T> sink) {
- recentData = data;
- timer ??= Timer(duration, () {
- sink.add(recentData);
- timer = null;
- if (shouldClose) {
- sink.close();
- }
- });
- }, handleDone: (EventSink<T> sink) {
- if (timer != null) {
- shouldClose = true;
- } else {
- sink.close();
- }
- });
-}
-
-/// Creates a [StreamTransformer] which collects values and emits when it sees a
-/// value on [trigger].
-///
-/// If there are no pending values when [trigger] emits, the next value on the
-/// source Stream will immediately flow through. Otherwise, the pending values
-/// are released when [trigger] emits.
-///
-/// Errors from the source stream or the trigger are immediately forwarded to
-/// the output.
-@Deprecated('Use the extension instead')
-StreamTransformer<T, List<T>> buffer<T>(Stream<void> trigger) =>
- AggregateSample<T, List<T>>(trigger, _collect);
-
List<T> _collect<T>(T event, List<T> soFar) => (soFar ?? <T>[])..add(event);
diff --git a/pkgs/stream_transform/lib/src/scan.dart b/pkgs/stream_transform/lib/src/scan.dart
index bd2073f..b31b9e7 100644
--- a/pkgs/stream_transform/lib/src/scan.dart
+++ b/pkgs/stream_transform/lib/src/scan.dart
@@ -26,25 +26,3 @@
});
}
}
-
-/// Scan is like fold, but instead of producing a single value it yields
-/// each intermediate accumulation.
-///
-/// If [combine] returns a Future it will not be called again for subsequent
-/// events from the source until it completes, therefor the combine callback is
-/// always called for elements in order, and the result stream always maintains
-/// the same order as the original.
-@Deprecated('Use the extension instead')
-StreamTransformer<S, T> scan<S, T>(
- T initialValue, FutureOr<T> combine(T previousValue, S element)) =>
- StreamTransformer.fromBind((source) {
- var accumulated = initialValue;
- return source.asyncMap((value) {
- var result = combine(accumulated, value);
- if (result is Future<T>) {
- return result.then((r) => accumulated = r);
- } else {
- return accumulated = result as T;
- }
- });
- });
diff --git a/pkgs/stream_transform/lib/src/switch.dart b/pkgs/stream_transform/lib/src/switch.dart
index eb58cc5..2e2aeba 100644
--- a/pkgs/stream_transform/lib/src/switch.dart
+++ b/pkgs/stream_transform/lib/src/switch.dart
@@ -32,29 +32,6 @@
Stream<T> switchLatest() => transform(_SwitchTransformer<T>());
}
-/// Maps events to a Stream and emits values from the most recently created
-/// Stream.
-///
-/// When the source emits a value it will be converted to a [Stream] using
-/// [convert] and the output will switch to emitting events from that result.
-///
-/// 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].
-@Deprecated('Use the extension instead')
-StreamTransformer<S, T> switchMap<S, T>(Stream<T> convert(S event)) =>
- StreamTransformer.fromBind(
- (source) => source.map(convert).transform(switchLatest()));
-
-/// Emits values from the most recently emitted Stream.
-///
-/// When the source emits a stream the output will switch to emitting events
-/// from that stream.
-///
-/// If the source stream is a broadcast stream, the result stream will be as
-/// well, regardless of the types of streams emitted.
-@Deprecated('Use the extension instead')
-StreamTransformer<Stream<T>, T> switchLatest<T>() => _SwitchTransformer<T>();
-
class _SwitchTransformer<T> extends StreamTransformerBase<Stream<T>, T> {
const _SwitchTransformer();
diff --git a/pkgs/stream_transform/lib/src/take_until.dart b/pkgs/stream_transform/lib/src/take_until.dart
index 862222e..43b35d1 100644
--- a/pkgs/stream_transform/lib/src/take_until.dart
+++ b/pkgs/stream_transform/lib/src/take_until.dart
@@ -16,16 +16,6 @@
Stream<T> takeUntil(Future<void> trigger) => transform(_TakeUntil(trigger));
}
-/// Emits values from the stream until [trigger] fires.
-///
-/// Completing [trigger] differs from canceling a subscription in that values
-/// which are emitted before the trigger, but have further asynchronous delays
-/// in transformations following the takeUtil, will still go through. Cancelling
-/// a subscription immediately stops values.
-@Deprecated('Use the extension instead')
-StreamTransformer<T, T> takeUntil<T>(Future<void> trigger) =>
- _TakeUntil(trigger);
-
class _TakeUntil<T> extends StreamTransformerBase<T, T> {
final Future<void> _trigger;
diff --git a/pkgs/stream_transform/lib/src/tap.dart b/pkgs/stream_transform/lib/src/tap.dart
index 5d8198f..1942b12 100644
--- a/pkgs/stream_transform/lib/src/tap.dart
+++ b/pkgs/stream_transform/lib/src/tap.dart
@@ -44,40 +44,3 @@
sink.close();
}));
}
-
-/// Taps into a Stream to allow additional handling on a single-subscriber
-/// stream without first wrapping as a broadcast stream.
-///
-/// The [onValue] callback will be called with every value from the original
-/// stream before it is forwarded to listeners on the resulting stream. May be
-/// null if only [onError] or [onDone] callbacks are needed.
-///
-/// The [onError] callback will be called with every error from the original
-/// stream before it is forwarded to listeners on the resulting stream.
-///
-/// The [onDone] callback will be called after the original stream closes and
-/// before the resulting stream is closed.
-///
-/// Errors from any of the callbacks are ignored.
-///
-/// The callbacks may not be called until the tapped stream has a listener, and
-/// may not be called after the listener has canceled the subscription.
-@Deprecated('Use the extension instead')
-StreamTransformer<T, T> tap<T>(void Function(T) onValue,
- {void Function(Object, StackTrace) onError, void Function() onDone}) =>
- fromHandlers(handleData: (value, sink) {
- try {
- onValue?.call(value);
- } catch (_) {/*Ignore*/}
- sink.add(value);
- }, handleError: (error, stackTrace, sink) {
- try {
- onError?.call(error, stackTrace);
- } catch (_) {/*Ignore*/}
- sink.addError(error, stackTrace);
- }, handleDone: (sink) {
- try {
- onDone?.call();
- } catch (_) {/*Ignore*/}
- sink.close();
- });
diff --git a/pkgs/stream_transform/lib/src/where.dart b/pkgs/stream_transform/lib/src/where.dart
index 33c0f7e..7026923 100644
--- a/pkgs/stream_transform/lib/src/where.dart
+++ b/pkgs/stream_transform/lib/src/where.dart
@@ -55,24 +55,6 @@
}
}
-/// Emits only the events which have type [R].
-///
-/// If the source stream is a broadcast stream the result will be as well.
-///
-/// Errors from the source stream are forwarded directly to the result stream.
-///
-/// The static type of the returned transformer takes `Null` so that it can
-/// satisfy the subtype requirements for the `stream.transform()` argument on
-/// any source stream. The argument to `bind` has been broadened to take
-/// `Stream<Object>` since it will never be passed a `Stream<Null>` at runtime.
-/// This is safe to use on any source stream.
-///
-/// [R] should be a subtype of the stream's generic type, otherwise nothing of
-/// type [R] could possibly be emitted, however there is no static or runtime
-/// checking that this is the case.
-@Deprecated('Use the extension instead')
-StreamTransformer<Null, R> whereType<R>() => _WhereType<R>();
-
class _WhereType<R> extends StreamTransformerBase<Null, R> {
@override
Stream<R> bind(Stream<Object> source) {
@@ -105,39 +87,3 @@
return controller.stream;
}
}
-
-/// Like [Stream.where] but allows the [test] to return a [Future].
-///
-/// Events on the result stream will be emitted in the order that [test]
-/// completes which may not match the order of the original stream.
-///
-/// If the source stream is a broadcast stream the result will be as well. When
-/// used with a broadcast stream behavior also differs from [Stream.where] in
-/// that the [test] function is only called once per event, rather than once
-/// per listener per event.
-///
-/// Errors from the source stream are forwarded directly to the result stream.
-/// Errors during the conversion are also forwarded to the result stream.
-///
-/// The result stream will not close until the source stream closes and all
-/// pending [test] calls have finished.
-@Deprecated('Use the extension instead')
-StreamTransformer<T, T> asyncWhere<T>(FutureOr<bool> test(T element)) {
- var valuesWaiting = 0;
- var sourceDone = false;
- return fromHandlers(handleData: (element, sink) {
- valuesWaiting++;
- () async {
- try {
- if (await test(element)) sink.add(element);
- } catch (e, st) {
- sink.addError(e, st);
- }
- valuesWaiting--;
- if (valuesWaiting <= 0 && sourceDone) sink.close();
- }();
- }, handleDone: (sink) {
- sourceDone = true;
- if (valuesWaiting <= 0) sink.close();
- });
-}
diff --git a/pkgs/stream_transform/lib/stream_transform.dart b/pkgs/stream_transform/lib/stream_transform.dart
index 2f7bf24..d04c4dd 100644
--- a/pkgs/stream_transform/lib/stream_transform.dart
+++ b/pkgs/stream_transform/lib/stream_transform.dart
@@ -3,10 +3,8 @@
// BSD-style license that can be found in the LICENSE file.
export 'src/async_map.dart';
-export 'src/chain_transformers.dart';
export 'src/combine_latest.dart';
export 'src/concatenate.dart';
-export 'src/map.dart';
export 'src/merge.dart';
export 'src/rate_limit.dart';
export 'src/scan.dart';
diff --git a/pkgs/stream_transform/pubspec.yaml b/pkgs/stream_transform/pubspec.yaml
index 8528f21..5442357 100644
--- a/pkgs/stream_transform/pubspec.yaml
+++ b/pkgs/stream_transform/pubspec.yaml
@@ -2,7 +2,7 @@
description: A collection of utilities to transform and manipulate streams.
author: Dart Team <misc@dartlang.org>
homepage: https://www.github.com/dart-lang/stream_transform
-version: 0.0.20
+version: 1.0.0
environment:
sdk: ">=2.6.0 <3.0.0"
@@ -10,6 +10,3 @@
dev_dependencies:
pedantic: ^1.5.0
test: ^1.0.0
- # Example
- build_runner: ^1.0.0
- build_web_compilers: ^2.0.0