get static method
get请求 headers和超时时长走options // 取消请求(同一个cancel token可以用于多个请求,当一个cancel token取消时,所有使用该cancel token的请求都会被取消)
Implementation
static Future get(String url, {
Options? options,
Map<String, dynamic>? queryParameters,
CancelToken? cancelToken,
}) async {
Response? response;
printWithSystemMethod("请求的地址是$url<===>超时时长设置的是${Http().httpDioConfig.connectTimeout}");
Options requestOptions = options ?? Options();
try {
printWithSystemMethod("========能不能拦截住===method=try=1=========");
response = await Http().dio.get(url, queryParameters: queryParameters, options: requestOptions, cancelToken: cancelToken ?? _cancelToken);
printWithSystemMethod("========能不能拦截住===method=try=2=========");
return _handleResponse2Page(response);
// } on DioException catch (e) {
} catch (e) {
printWithSystemMethod("========能不能拦截住===method==4=====拦截器已经转换==$e==");
if (e is DioException) {
return e.error;
}
return e; //appException
}
}