addStream method
Provide a stream that produces the content.
Note: any headers must be defined before this method is called. Headers cannot be defined after the stream has started.
Implementation
Future<ResponseStream> addStream(
Request req, Stream<List<int>> stream) async {
if (req == null) {
throw new ArgumentError.notNull("req");
}
if (_streamState == 1) {
throw new StateError("addStream invoked when stream not finished");
}
if (_streamState == 0) {
// First invocation of addStream
super._outputHeaders(req);
}
_streamState = 1;
await req._streamBody(stream);
_streamState = 2;
return this;
}