| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library async.stream_completer; | |
| 6 | |
| 7 import "dart:async"; | 5 import "dart:async"; |
| 8 | 6 |
| 9 /// A single-subscription [stream] where the contents are provided later. | 7 /// A single-subscription [stream] where the contents are provided later. |
| 10 /// | 8 /// |
| 11 /// It is generally recommended that you never create a `Future<Stream>` | 9 /// It is generally recommended that you never create a `Future<Stream>` |
| 12 /// because you can just directly create a stream that doesn't do anything | 10 /// because you can just directly create a stream that doesn't do anything |
| 13 /// until it's ready to do so. | 11 /// until it's ready to do so. |
| 14 /// This class can be used to create such a stream. | 12 /// This class can be used to create such a stream. |
| 15 /// | 13 /// |
| 16 /// The [stream] is a normal stream that you can listen to immediately, | 14 /// The [stream] is a normal stream that you can listen to immediately, |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 _sourceStream = _controller.stream; // Mark stream as set. | 177 _sourceStream = _controller.stream; // Mark stream as set. |
| 180 _controller.close(); | 178 _controller.close(); |
| 181 } | 179 } |
| 182 | 180 |
| 183 // Creates the [_controller]. | 181 // Creates the [_controller]. |
| 184 void _createController() { | 182 void _createController() { |
| 185 assert(_controller == null); | 183 assert(_controller == null); |
| 186 _controller = new StreamController<T>(sync: true); | 184 _controller = new StreamController<T>(sync: true); |
| 187 } | 185 } |
| 188 } | 186 } |
| OLD | NEW |