read method

FutureOr<T> read()

Whether stream is end (include error occur) Read first data of current data stream If stream is released or end, return null

Implementation

/// Read first data of current data stream
/// If stream is released or end, return null
FutureOr<T> read() async {
	if (_isEnd || _isRelease) {
		return null;
	}

	if (_bufferEvent != null) {
		final tempBuffer = _bufferEvent;
		_bufferEvent = null;
		_subscription.resume();
		return tempBuffer;
	}

	_readCompleter ??= Completer();

	return _readCompleter.future;
}