Chromium Code Reviews| Index: lib/src/two_way_stream.dart |
| diff --git a/lib/src/two_way_stream.dart b/lib/src/two_way_stream.dart |
| index 5914173876f6d21799bfdcc1c34cd45471c71852..5644c126621a060bb7c6b79f265a4ab9e4468ceb 100644 |
| --- a/lib/src/two_way_stream.dart |
| +++ b/lib/src/two_way_stream.dart |
| @@ -38,6 +38,10 @@ class TwoWayStream { |
| Future get done => _doneCompleter.future; |
| final _doneCompleter = new Completer(); |
| + /// Whether the stream has been closed. |
| + bool get isClosed => _isClosed; |
|
Bob Nystrom
2015/09/03 18:13:03
Can this just be => _doneCompleter.isCompleted?
nweiz
2015/09/08 21:17:32
Done.
|
| + bool _isClosed = false; |
| + |
| /// Creates a two-way stream. |
| /// |
| /// [input] and [output] should emit and take (respectively) JSON-encoded |
| @@ -123,6 +127,7 @@ class TwoWayStream { |
| throw new StateError("Can't call $_name.close before $_name.listen."); |
| } |
| + _isClosed = true; |
| if (!_doneCompleter.isCompleted) _doneCompleter.complete(); |
| var inputFuture = _inputSubscription.cancel(); |