request static method
Future
request(
- String url, {
- String method = XHttp.GET,
- Map<String, dynamic>? queryParameters,
- Map<String, dynamic>? data,
- bool isCancelWhiteList = false,
- dynamic resultDialogConfig,
- Options? options,
- void onSendProgress(
- int,
- int
)?,
- void onReceiveProgress(
- int,
- int
)?,
- String? msg,
- String? baseUrl,
})
Implementation
static Future request(
String url, {
String method = XHttp.GET,
Map<String, dynamic>? queryParameters,
Map<String, dynamic>? data,
bool isCancelWhiteList = false,
resultDialogConfig,
Options? options,
void Function(int, int)? onSendProgress,
void Function(int, int)? onReceiveProgress,
String? msg,
String? baseUrl,
}) async {
XHttp.getInstance(baseUrl: baseUrl, msg: msg);
Response? response;
try {
response = await dio?.request(
url,
options: options ??
Options(
method: method, contentType: Headers.formUrlEncodedContentType),
queryParameters: queryParameters,
data: data,
cancelToken: isCancelWhiteList ? whiteListCancelToken : cancelToken,
onReceiveProgress: onReceiveProgress,
onSendProgress: onSendProgress,
);
return response?.data;
} catch (e) {
_instance._catchOthersError(e);
} finally {
_instance._showResultDialog(
response,
resultDialogConfig ?? {'type': XHttp.DIALOG_TYPE_OTHERS},
);
}
}