Index: sdk/lib/io/file_impl.dart |
diff --git a/sdk/lib/io/file_impl.dart b/sdk/lib/io/file_impl.dart |
index d1569d7a6e0cfe5ad964542d470c5c669abd6bf9..9b557ba3bf4620ef331065807909f4732b1171bd 100644 |
--- a/sdk/lib/io/file_impl.dart |
+++ b/sdk/lib/io/file_impl.dart |
@@ -47,8 +47,13 @@ class _FileStream extends Stream<List<int>> { |
void _setupController() { |
_controller = new StreamController<List<int>>( |
- onSubscriptionStateChange: _onSubscriptionStateChange, |
- onPauseStateChange: _onPauseStateChange); |
+ onListen: _start, |
+ onPause: () => _paused = true, |
+ onResume: _resume, |
+ onCancel: () { |
+ _unsubscribed = true; |
+ _closeFile(); |
+ }); |
} |
Future _closeFile() { |
@@ -128,23 +133,6 @@ class _FileStream extends Stream<List<int>> { |
// Resume reading unless we are already done. |
if (_openedFile != null) _readBlock(); |
} |
- |
- void _onSubscriptionStateChange() { |
- if (_controller.hasListener) { |
- _start(); |
- } else { |
- _unsubscribed = true; |
- _closeFile(); |
- } |
- } |
- |
- void _onPauseStateChange() { |
- if (_controller.isPaused) { |
- _paused = true; |
- } else { |
- _resume(); |
- } |
- } |
} |
class _FileStreamConsumer extends StreamConsumer<List<int>> { |