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 library async.stream_sink_completer; | |
6 | |
7 import 'dart:async'; | 5 import 'dart:async'; |
8 | 6 |
9 import 'null_stream_sink.dart'; | 7 import 'null_stream_sink.dart'; |
10 | 8 |
11 /// A [sink] where the destination is provided later. | 9 /// A [sink] where the destination is provided later. |
12 /// | 10 /// |
13 /// The [sink] is a normal sink that you can add events to to immediately, but | 11 /// The [sink] is a normal sink that you can add events to to immediately, but |
14 /// until [setDestinationSink] is called, the events will be buffered. | 12 /// until [setDestinationSink] is called, the events will be buffered. |
15 /// | 13 /// |
16 /// The same effect can be achieved by using a [StreamController] and adding it | 14 /// The same effect can be achieved by using a [StreamController] and adding it |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 .catchError((_) {}); | 169 .catchError((_) {}); |
172 } | 170 } |
173 | 171 |
174 // If the user has already asked when the sink is done, connect the sink's | 172 // If the user has already asked when the sink is done, connect the sink's |
175 // done callback to that completer. | 173 // done callback to that completer. |
176 if (_doneCompleter != null) { | 174 if (_doneCompleter != null) { |
177 _doneCompleter.complete(sink.done); | 175 _doneCompleter.complete(sink.done); |
178 } | 176 } |
179 } | 177 } |
180 } | 178 } |
OLD | NEW |