Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Unified Diff: utils/pub/utils.dart

Issue 14136004: Remove StreamController.broadcast. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: utils/pub/utils.dart
diff --git a/utils/pub/utils.dart b/utils/pub/utils.dart
index 47c27fc89b49f67a7cf5276d24a3dc3389cc388a..52304439f9673795d95415c4d39d9931f22402a7 100644
--- a/utils/pub/utils.dart
+++ b/utils/pub/utils.dart
@@ -179,13 +179,14 @@ Future streamFirst(Stream stream) {
/// Returns a wrapped version of [stream] along with a [StreamSubscription] that
/// can be used to control the wrapped stream.
Pair<Stream, StreamSubscription> streamWithSubscription(Stream stream) {
- var controller = stream.isBroadcast ?
- new StreamController.broadcast() :
- new StreamController();
+ var controller = new StreamController();
+ var controllerStream = stream.isBroadcast ?
+ controller.stream.asBroadcastStream() :
+ controller.stream;
var subscription = stream.listen(controller.add,
onError: controller.addError,
onDone: controller.close);
- return new Pair<Stream, StreamSubscription>(controller.stream, subscription);
+ return new Pair<Stream, StreamSubscription>(controllerStream, subscription);
}
// TODO(nweiz): remove this when issue 7787 is fixed.

Powered by Google App Engine
This is Rietveld 408576698