| Index: sdk/lib/io/file_impl.dart
|
| diff --git a/sdk/lib/io/file_impl.dart b/sdk/lib/io/file_impl.dart
|
| index aa2e495645abb0a6464a060656daad4b7adf2f42..05c33f605b68581652762c514dd82c05b6dd9c90 100644
|
| --- a/sdk/lib/io/file_impl.dart
|
| +++ b/sdk/lib/io/file_impl.dart
|
| @@ -95,20 +95,23 @@ class _FileStream extends Stream<List<int>> {
|
| }
|
| _openedFile.read(readBytes)
|
| .then((block) {
|
| + _readInProgress = false;
|
| if (_unsubscribed) {
|
| _closeFile();
|
| return;
|
| }
|
| - _readInProgress = false;
|
| _position += block.length;
|
| if (block.length < readBytes ||
|
| (_end != null && _position == _end)) {
|
| _atEnd = true;
|
| }
|
| - _controller.add(block);
|
| - if (!_controller.isPaused) {
|
| + if (!_atEnd && !_controller.isPaused) {
|
| _readBlock();
|
| }
|
| + _controller.add(block);
|
| + if (_atEnd) {
|
| + _closeFile();
|
| + }
|
| })
|
| .catchError((e, s) {
|
| if (!_unsubscribed) {
|
|
|