Response constructor Null safety
Creates a HTTP Response object.
Implementation
Response(
this.statusCode,
this.reasonPhrase,
this.headers,
dynamic body, {
this.redirects,
this.requestAddress,
this.responseAddress,
}) {
if (body is String) {
_bodyText = body;
} else if (body is List<int>) {
_bodyBytes = body;
} else if (body is Stream<List<int>>) {
_doneCompleter = Completer();
_bodyStream =
body.transform(StreamTransformer<List<int>, List<int>>.fromHandlers(
handleDone: (sink) {
sink.close();
_doneCompleter.complete();
},
));
} else {
_body = body;
}
}