Index: lib/stream_channel.dart |
diff --git a/lib/stream_channel.dart b/lib/stream_channel.dart |
index 7fff6744cd8c9b8b7e60d8c0a113f69887a4f41e..8c4fad5205dc48cfd115b5b6368645a3ba443945 100644 |
--- a/lib/stream_channel.dart |
+++ b/lib/stream_channel.dart |
@@ -6,6 +6,7 @@ import 'dart:async'; |
import 'package:async/async.dart'; |
+import 'src/guarantee_channel.dart'; |
import 'src/stream_channel_transformer.dart'; |
export 'src/delegating_stream_channel.dart'; |
@@ -13,6 +14,7 @@ export 'src/isolate_channel.dart'; |
export 'src/json_document_transformer.dart'; |
export 'src/multi_channel.dart'; |
export 'src/stream_channel_completer.dart'; |
+export 'src/stream_channel_controller.dart'; |
export 'src/stream_channel_transformer.dart'; |
/// An abstract class representing a two-way communication channel. |
@@ -65,10 +67,20 @@ abstract class StreamChannel<T> { |
/// Creates a new [StreamChannel] that communicates over [stream] and [sink]. |
/// |
/// Note that this stream/sink pair must provide the guarantees listed in the |
- /// [StreamChannel] documentation. |
+ /// [StreamChannel] documentation. If they don't do so natively, [new |
+ /// StreamChannel.withGuarantees] should be used instead. |
factory StreamChannel(Stream<T> stream, StreamSink<T> sink) => |
new _StreamChannel<T>(stream, sink); |
+ /// Creates a new [StreamChannel] that communicates over [stream] and [sink]. |
+ /// |
+ /// Unlike [new StreamChannel], this enforces the guarantees listed in the |
+ /// [StreamChannel] documentation. This makes it somewhat less efficient than |
+ /// just wrapping a stream and a sink directly, so [new StreamChannel] should |
+ /// be used when the guarantees are provided natively. |
+ factory StreamChannel.withGuarantees(Stream<T> stream, StreamSink<T> sink) => |
+ new GuaranteeChannel(stream, sink); |
+ |
/// Connects [this] to [other], so that any values emitted by either are sent |
/// directly to the other. |
void pipe(StreamChannel<T> other); |