# ready method

1. @override

Future<bool> ready()
override

Tells whether this stream is ready to be read.

## Returns

True if the next read() is guaranteed not to block for input, false otherwise. Note that returning false does not guarantee that the next read will block.

## Example

    final reader = FileReader('data.txt');
    try {
      if (await reader.ready()) {
        final content = await reader.readAll();
        processContent(content);
      } else {
        print('Reader not ready, may block on read');
      }
    } finally {
      await reader.close();
    }

Throws IOException if an I/O error occurs. Throws StreamClosedException if the reader has been closed.

## Implementation

    @override
    Future<bool> ready() async {
      checkClosed();
      return _position < _buffer.length;
    }