Remove StreamChannelTransformer.typed (dart-lang/stream_channel#44) Closes dart-lang/stream_channel#41 I cannot find any uses of this and it can be replaced with a call to `cast`.
diff --git a/pkgs/stream_channel/CHANGELOG.md b/pkgs/stream_channel/CHANGELOG.md index 8ebdc28..60400e0 100644 --- a/pkgs/stream_channel/CHANGELOG.md +++ b/pkgs/stream_channel/CHANGELOG.md
@@ -8,6 +8,8 @@ concerns due to importing `dart:isolate`. * Remove `JsonDocumentTransformer` class. The `jsonDocument` top level is still available. +* Remove `StreamChannelTransformer.typed`. Use `.cast` on the transformed + channel instead. ## 1.7.0
diff --git a/pkgs/stream_channel/lib/src/stream_channel_transformer.dart b/pkgs/stream_channel/lib/src/stream_channel_transformer.dart index 32d36b6..cf62c76 100644 --- a/pkgs/stream_channel/lib/src/stream_channel_transformer.dart +++ b/pkgs/stream_channel/lib/src/stream_channel_transformer.dart
@@ -8,7 +8,6 @@ import 'package:async/async.dart'; import '../stream_channel.dart'; -import 'transformer/typed.dart'; /// A [StreamChannelTransformer] transforms the events being passed to and /// emitted by a [StreamChannel]. @@ -32,21 +31,6 @@ /// The transformer to use on the channel's sink. final StreamSinkTransformer<S, T> _sinkTransformer; - /// Creates a wrapper that coerces the type of [transformer]. - /// - /// This soundly converts a [StreamChannelTransformer] to a - /// `StreamChannelTransformer<S, T>`, regardless of its original generic type, - /// by asserting that the events emitted by the transformed channel's stream - /// are instances of `T` whenever they're provided. If they're not, the stream - /// throws a [CastError]. This also means that calls to [StreamSink.add] on - /// the transformed channel's sink may throw a [CastError] if the argument - /// type doesn't match the reified type of the sink. - static StreamChannelTransformer<S, T> typed<S, T>( - StreamChannelTransformer transformer) => - transformer is StreamChannelTransformer<S, T> - ? transformer - : TypeSafeStreamChannelTransformer(transformer); - /// Creates a [StreamChannelTransformer] from existing stream and sink /// transformers. const StreamChannelTransformer(
diff --git a/pkgs/stream_channel/lib/src/transformer/typed.dart b/pkgs/stream_channel/lib/src/transformer/typed.dart deleted file mode 100644 index 875cdac..0000000 --- a/pkgs/stream_channel/lib/src/transformer/typed.dart +++ /dev/null
@@ -1,18 +0,0 @@ -// Copyright (c) 2016, 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 '../../stream_channel.dart'; - -/// A wrapper that coerces the generic type of the channel returned by an inner -/// transformer to `S`. -class TypeSafeStreamChannelTransformer<S, T> - implements StreamChannelTransformer<S, T> { - final StreamChannelTransformer _inner; - - TypeSafeStreamChannelTransformer(this._inner); - - @override - StreamChannel<S> bind(StreamChannel<T> channel) => - _inner.bind(channel).cast(); -}