fetch method
Implement this method to make real HTTP requests.
options
are the request options.
requestStream
is the request stream. It will not be null only when
the request body is not empty.
Use requestStream
if your code rely on RequestOptions.onSendProgress
.
cancelFuture
corresponds to CancelToken
handling.
When the request is canceled, cancelFuture
will be resolved.
To await if a request has been canceled:
cancelFuture?.then((_) => print('request cancelled!'));
Implementation
@override
Future<ResponseBody> fetch(
RequestOptions options,
Stream<Uint8List>? requestStream,
Future<void>? cancelFuture,
) {
// Recursive fetching.
final redirects = <RedirectRecord>[];
return _fetch(options, requestStream, cancelFuture, redirects);
}