BaseRequest class abstract

A common API that applies to all request types. The piece that is missing is that which is specific to the request body. Setting the request body differs based on the type of request being sent (plain-text, JSON, form, multipart, or streamed). As such, that piece of the API is delegated to the specific request classes.

Implementers

Constructors

BaseRequest()

Properties

autoRetry ↔ RequestAutoRetry
Configuration of automatic request retrying for failed requests. Use this object to enable or disable automatic retrying, configure the criteria that determines whether or not a request should be retried, as well as the number of retries to attempt.
getter/setter pair
contentLength int?
Gets and sets the content-length of the request, in bytes. If the size of the request is not known in advance, set this to null.
getter/setter pair
contentType MediaType?
Content-type of this request.
getter/setter pair
done Future<Null>
Future that resolves when the request has completed (successful or otherwise).
no setter
downloadProgress Stream<RequestProgress>
RequestProgress stream for this HTTP request's download.
no setter
encoding Encoding?
Encoding to use when encoding or decoding the request body. Setting this will also update the contentType's charset.
getter/setter pair
fragment String
The URI fragment or hash.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
Headers to send with the HTTP request. Headers are case-insensitive.
getter/setter pair
host String
The URI host, including sub-domains and the tld.
getter/setter pairinherited
isDone bool
Returns true if this request is complete (successful or failed), false otherwise.
no setter
method String?
HTTP method ('GET', 'POST', etc). Set automatically when the request is sent via one of the request dispatch methods.
no setter
path String
The URI path.
getter/setter pairinherited
pathSegments Iterable<String>
The URI path segments.
getter/setter pairinherited
port int
The URI port number.
getter/setter pairinherited
query String
The URI query string.
getter/setter pairinherited
queryParameters Map<String, String>
The URI query parameters.
getter/setter pairinherited
queryParametersAll Map<String, List<String>>
The URI query parameters with support for multi-value params.
getter/setter pairinherited
requestInterceptor ↔ RequestInterceptor?
Hook into the request lifecycle right before the request is sent.
getter/setter pair
responseInterceptor ↔ ResponseInterceptor?
Hook into the request lifecycle after the response has been received and before the request is considered "complete" (in other words, before the response is delivered to the caller).
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scheme String
The URI scheme or protocol. Examples: http, https, ws.
getter/setter pairinherited
timeoutThreshold Duration?
Amount of time to wait for the request to finish before canceling it and considering it "timed out" (results in a RequestException being thrown).
getter/setter pair
uploadProgress Stream<RequestProgress>
RequestProgress stream for this HTTP request's upload.
no setter
uri Uri
The full URI.
getter/setter pairinherited
withCredentials bool
Whether or not to send the request with credentials. Only applicable to requests in the browser, but does not adversely affect any other platform.
getter/setter pair

Methods

abort([Object? error]) → void
Cancel this request. If the request has already finished, this will do nothing.
addPathSegment(String pathSegment) → void
Add a single path segment to the end of the current path.
inherited
appendToPath(String pathToAppend) → void
Append to the current path.
inherited
clone() BaseRequest
Returns an clone of this request.
configure(dynamic configure(Object request)) → void
Allows more advanced configuration of this request prior to sending. The supplied callback configure will be called after opening, but prior to sending, this request. The request parameter will either be an instance of HttpRequest or HttpClientRequest, depending on the platform. If configure returns a Future, the request will not be sent until the returned Future completes.
delete({Map<String, String>? headers, Uri? uri}) Future<Response>
Send a DELETE request.
inherited
get({Map<String, String>? headers, Uri? uri}) Future<Response>
Send a GET request.
inherited
Send a HEAD request.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
options({Map<String, String>? headers, Uri? uri}) Future<Response>
Send an OPTIONS request.
inherited
patch({dynamic body, Map<String, String>? headers, Uri? uri}) Future<Response>
Send a PATCH request.
inherited
post({dynamic body, Map<String, String>? headers, Uri? uri}) Future<Response>
Send a POST request.
inherited
put({dynamic body, Map<String, String>? headers, Uri? uri}) Future<Response>
Send a PUT request.
inherited
removeQueryParam(String param) → void
Remove param from the URI query parameters.
inherited
retry() Future<Response>
Retry this request. Throws a StateError if this request did not or has yet to fail.
send(String? method, {dynamic body, Map<String, String>? headers, Uri? uri}) Future<Response>
Send an HTTP request with a custom method.
inherited
setQueryParam(String param, dynamic value) → void
Set a single query parameter.
inherited
streamDelete({Map<String, String>? headers, Uri? uri}) Future<StreamedResponse>
Send a DELETE request. The response will be streamed, meaning the body will be available asynchronously. This is useful for large response bodies or for proxies.
inherited
streamGet({Map<String, String>? headers, Uri? uri}) Future<StreamedResponse>
Send a GET request. The response will be streamed, meaning the body will be available asynchronously. This is useful for large response bodies or for proxies.
inherited
streamHead({Map<String, String>? headers, Uri? uri}) Future<StreamedResponse>
Send a HEAD request. The response will be streamed, meaning the body will be available asynchronously. This is useful for large response bodies or for proxies.
inherited
streamOptions({Map<String, String>? headers, Uri? uri}) Future<StreamedResponse>
Send an OPTIONS request. The response will be streamed, meaning the body will be available asynchronously. This is useful for large response bodies or for proxies.
inherited
streamPatch({dynamic body, Map<String, String>? headers, Uri? uri}) Future<StreamedResponse>
Send a PATCH request. The response will be streamed, meaning the body will be available asynchronously. This is useful for large response bodies or for proxies.
inherited
streamPost({dynamic body, Map<String, String>? headers, Uri? uri}) Future<StreamedResponse>
Send a POST request. The response will be streamed, meaning the body will be available asynchronously. This is useful for large response bodies or for proxies.
inherited
streamPut({dynamic body, Map<String, String>? headers, Uri? uri}) Future<StreamedResponse>
Send a PUT request. The response will be streamed, meaning the body will be available asynchronously. This is useful for large response bodies or for proxies.
inherited
streamRetry() Future<StreamedResponse>
Retry this request and stream the response. Throws a StateError if this request did not or has yet to fail.
streamSend(String? method, {dynamic body, Map<String, String>? headers, Uri? uri}) Future<StreamedResponse>
Send an HTTP request with a custom method. The response will be streamed, meaning the body will be available asynchronously. This is useful for large response bodies or for proxies.
inherited
toString() String
A string representation of this object.
inherited
updateQuery(Map<String, dynamic> queryParametersToUpdate, {bool mergeValues = false}) → void
Update the URI query parameters, merging the given map with the current query parameters map instead of overwriting it.
inherited

Operators

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