bodyAsStream property Null safety
HTTP body content as Stream.
Implementation
Stream<List<int>?>? get bodyAsStream {
if (_bodyStream != null) {
return _bodyStream;
}
if (_bodyBytes != null) {
_bodyStream ??= Stream.fromIterable([_bodyBytes]);
return _bodyStream;
}
if (_bodyText != null) {
_bodyStream ??= Stream.fromIterable([c.utf8.encode(_bodyText!)]);
}
if (_body != null) {
throw StateError('Unable to convert body to Stream');
}
return null;
}