HttpClientRequest class abstract

HTTP request for a client connection.

It handles all of the Http Requests made by HttpClient. Provides two ways to get data from the request. registerCallbacks or a HttpClientResponse which is a Stream<List<int>>. Either of them can be used at a time.

Example Usage:

final client = HttpClient();
client.getUrl(Uri.parse('https://example.com/'))
  .then((HttpClientRequest request) {
  return request.close();
}).then((HttpClientResponse response) {
  // Here you got the raw data.
  // Use it as you like.
});
Implemented types

Constructors

HttpClientRequest()

Properties

done Future<HttpClientResponse>
This is same as close. A HttpClientResponse future that will complete once the request is successfully made.
no setteroverride
encoding Encoding
The Encoding used when writing strings.
getter/setter pairoverride
followRedirects bool
Follow the redirects.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
headers HttpHeaders
Returns the client request headers.
no setter
maxRedirects int
Maximum numbers of redirects to follow. Have no effect if followRedirects is set to false.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
uri Uri
The uri of the request.
no setter

Methods

add(List<int> data) → void
Adds byte data to the target consumer, ignoring encoding.
inherited
addError(Object error, [StackTrace? stackTrace]) → void
Passes the error to the target consumer as an error event.
inherited
addStream(Stream<List<int>> stream) Future
Adds all elements of the given stream.
inherited
close() Future<HttpClientResponse>
Returns Future of HttpClientResponse which can be listened for server response.
override
flush() Future
Returns a Future that completes once all buffered data is accepted by the underlying StreamConsumer.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
write(Object? object) → void
Converts object to a String by invoking Object.toString and adds the encoding of the result to the target consumer.
inherited
writeAll(Iterable objects, [String separator = ""]) → void
Iterates over the given objects and writes them in sequence.
inherited
writeCharCode(int charCode) → void
Writes the character of charCode.
inherited
writeln([Object? object = ""]) → void
Converts object to a String by invoking Object.toString and writes the result to this, followed by a newline.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited