OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'stream_sink_transformer/handler_transformer.dart'; | 7 import 'stream_sink_transformer/handler_transformer.dart'; |
8 import 'stream_sink_transformer/stream_transformer_wrapper.dart'; | 8 import 'stream_sink_transformer/stream_transformer_wrapper.dart'; |
9 import 'stream_sink_transformer/typed.dart'; | 9 import 'stream_sink_transformer/typed.dart'; |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 /// transform them and pass the transformed versions to [sink]. | 47 /// transform them and pass the transformed versions to [sink]. |
48 StreamSink<S> bind(StreamSink<T> sink); | 48 StreamSink<S> bind(StreamSink<T> sink); |
49 | 49 |
50 /// Creates a wrapper that coerces the type of [transformer]. | 50 /// Creates a wrapper that coerces the type of [transformer]. |
51 /// | 51 /// |
52 /// This soundly converts a [StreamSinkTransformer] to a | 52 /// This soundly converts a [StreamSinkTransformer] to a |
53 /// `StreamSinkTransformer<S, T>`, regardless of its original generic type. | 53 /// `StreamSinkTransformer<S, T>`, regardless of its original generic type. |
54 /// This means that calls to [StreamSink.add] on the returned sink may throw a | 54 /// This means that calls to [StreamSink.add] on the returned sink may throw a |
55 /// [CastError] if the argument type doesn't match the reified type of the | 55 /// [CastError] if the argument type doesn't match the reified type of the |
56 /// sink. | 56 /// sink. |
57 static StreamSinkTransformer/*<S, T>*/ typed/*<S, T>*/( | 57 static StreamSinkTransformer<S, T> typed<S, T>( |
58 StreamSinkTransformer transformer) => | 58 StreamSinkTransformer transformer) => |
59 transformer is StreamSinkTransformer/*<S, T>*/ | 59 transformer is StreamSinkTransformer<S, T> |
60 ? transformer | 60 ? transformer |
61 : new TypeSafeStreamSinkTransformer(transformer); | 61 : new TypeSafeStreamSinkTransformer(transformer); |
62 } | 62 } |
OLD | NEW |