| Index: lib/src/delegate/event_sink.dart
|
| diff --git a/lib/src/delegate/event_sink.dart b/lib/src/delegate/event_sink.dart
|
| index 5a525dfc8c55d079a21ef7f4e0c0366134a9889a..14501b28d3ea65906c4cf3ebd51cf5a5c61e74ac 100644
|
| --- a/lib/src/delegate/event_sink.dart
|
| +++ b/lib/src/delegate/event_sink.dart
|
| @@ -12,7 +12,18 @@ class DelegatingEventSink<T> implements EventSink<T> {
|
| final EventSink _sink;
|
|
|
| /// Create a delegating sink forwarding calls to [sink].
|
| - DelegatingEventSink(EventSink sink) : _sink = sink;
|
| + DelegatingEventSink(EventSink<T> sink) : _sink = sink;
|
| +
|
| + DelegatingEventSink._(this._sink);
|
| +
|
| + /// Creates a wrapper that coerces the type of [sink].
|
| + ///
|
| + /// Unlike [new DelegatingEventSink], this only requires its argument to be an
|
| + /// instance of `EventSink`, not `EventSink<T>`. This means that calls to
|
| + /// [add] may throw a [CastError] if the argument type doesn't match the
|
| + /// reified type of [sink].
|
| + static EventSink/*<T>*/ typed/*<T>*/(EventSink sink) =>
|
| + sink is EventSink/*<T>*/ ? sink : new DelegatingEventSink._(sink);
|
|
|
| void add(T data) {
|
| _sink.add(data);
|
|
|