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.
Implementation
@override
Future<Response<T>> request<T>(
String path, {
Object? data,
Map<String, dynamic>? queryParameters,
CancelToken? cancelToken,
Options? options,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
if (cancelToken != null && cancelToken.isCancelled) {
throw cancelToken.cancelError!;
}
final requestOptions = (options ?? Options()).compose(
this.options,
path,
data: data,
queryParameters: queryParameters,
onReceiveProgress: onReceiveProgress,
onSendProgress: onSendProgress,
cancelToken: cancelToken,
sourceStackTrace: StackTrace.current,
);
if (_closed) {
throw DioException.connectionError(
reason: "Dio can't establish a new connection after it was closed.",
requestOptions: requestOptions,
);
}
return fetch<T>(requestOptions);
}