bytesAvailable property

Future<int> get bytesAvailable

Returns the number of bytes that can be read from the internal buffer. If we're at EOF, returns zero, otherwise, returns a non-zero positive integer. If the buffer is currently exhausted, this method will wait for the next block of data to come in.

Implementation

Future<int> get bytesAvailable async {
  if (await isEOF()) {
    return 0;
  }
  return _curr!.length - _pos;
}