remainingStreamBytesHint property

int? remainingStreamBytesHint

Returns the number of bytes of the stream that have not been read yet, if known. This is a hint only, and may thus be incorrect - it can only be used to pre-allocate memory in readers in order to hopefully reduce repeated re-allocations, not to determine if the stream is finished. If more bytes have already been read than the hint promised, the result is by definition invalid and null will be returned.

Implementation

int? get remainingStreamBytesHint {
  if (_streamSizeBytesHint == null) return null;
  final result = _streamSizeBytesHint! - bytesRead;
  return (result < 0) ? null : result;
}