| 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.null_stream_sink; | |
| 6 | |
| 7 import 'dart:async'; | 5 import 'dart:async'; |
| 8 | 6 |
| 9 /// A [StreamSink] that discards all events. | 7 /// A [StreamSink] that discards all events. |
| 10 /// | 8 /// |
| 11 /// The sink silently drops events until [close] is called, at which point it | 9 /// The sink silently drops events until [close] is called, at which point it |
| 12 /// throws [StateError]s when events are added. This is the same behavior as a | 10 /// throws [StateError]s when events are added. This is the same behavior as a |
| 13 /// sink whose remote end has closed, such as when a [WebSocket] connection has | 11 /// sink whose remote end has closed, such as when a [WebSocket] connection has |
| 14 /// been closed. | 12 /// been closed. |
| 15 /// | 13 /// |
| 16 /// This can be used when a sink is needed but no events are actually intended | 14 /// This can be used when a sink is needed but no events are actually intended |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 if (_addingStream) { | 79 if (_addingStream) { |
| 82 throw new StateError("Cannot add to a sink while adding a stream."); | 80 throw new StateError("Cannot add to a sink while adding a stream."); |
| 83 } | 81 } |
| 84 } | 82 } |
| 85 | 83 |
| 86 Future close() { | 84 Future close() { |
| 87 _closed = true; | 85 _closed = true; |
| 88 return done; | 86 return done; |
| 89 } | 87 } |
| 90 } | 88 } |
| OLD | NEW |