| Index: lib/src/delegate/stream_consumer.dart
|
| diff --git a/lib/src/delegate/stream_consumer.dart b/lib/src/delegate/stream_consumer.dart
|
| index dcaf0c258dece3da3469abe880ea5713e93964cf..4f495d0ef5a008bcc2a6bd14ea7df188899ed883 100644
|
| --- a/lib/src/delegate/stream_consumer.dart
|
| +++ b/lib/src/delegate/stream_consumer.dart
|
| @@ -12,8 +12,20 @@ class DelegatingStreamConsumer<T> implements StreamConsumer<T> {
|
| final StreamConsumer _consumer;
|
|
|
| /// Create a delegating consumer forwarding calls to [consumer].
|
| - DelegatingStreamConsumer(StreamConsumer consumer)
|
| - : _consumer = consumer;
|
| + DelegatingStreamConsumer(StreamConsumer<T> consumer) : _consumer = consumer;
|
| +
|
| + DelegatingStreamConsumer._(this._consumer);
|
| +
|
| + /// Creates a wrapper that coerces the type of [consumer].
|
| + ///
|
| + /// Unlike [new StreamConsumer], this only requires its argument to be an
|
| + /// instance of `StreamConsumer`, not `StreamConsumer<T>`. This means that
|
| + /// calls to [addStream] may throw a [CastError] if the argument type doesn't
|
| + /// match the reified type of [consumer].
|
| + static StreamConsumer/*<T>*/ typed/*<T>*/(StreamConsumer consumer) =>
|
| + consumer is StreamConsumer/*<T>*/
|
| + ? consumer
|
| + : new DelegatingStreamConsumer._(consumer);
|
|
|
| Future addStream(Stream<T> stream) => _consumer.addStream(stream);
|
|
|
|
|