request<T> method
Future<Response<T> >
request<T>(
- String path, {
- Object? data,
- Map<
String, dynamic> ? queryParameters, - CancelToken? cancelToken,
- Options? options,
- ProgressCallback? onSendProgress,
- ProgressCallback? onReceiveProgress,
override
Make http request with options.
path
The url path.
data
The request data
options
The request options.
Implementation
@override
Future<Response<T>> request<T>(
String path, {
Object? data,
Map<String, dynamic>? queryParameters,
CancelToken? cancelToken,
Options? options,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
options ??= Options();
final requestOptions = options.compose(
this.options,
path,
data: data,
queryParameters: queryParameters,
onReceiveProgress: onReceiveProgress,
onSendProgress: onSendProgress,
cancelToken: cancelToken,
);
requestOptions.onReceiveProgress = onReceiveProgress;
requestOptions.onSendProgress = onSendProgress;
requestOptions.cancelToken = cancelToken;
if (_closed) {
throw DioError.connectionError(
reason: "Dio can't establish a new connection after it was closed.",
requestOptions: requestOptions,
);
}
return fetch<T>(requestOptions);
}