request2Post method
dynamic
request2Post(})
Implementation
request2Post(String url, BuildContext context,
{bool isShowLoading = true,
String? loadingContent ,
dynamic data,
bool isShowToast = true, //是否弹出异常的message
bool isNeedAllData = false, //是否要返回所有的数据 其他服务与主服务器返回的数据结构不同
Map<String, dynamic>? queryParameters}) async {
//async 所以回去了还是个future
if (isShowLoading) {
updateLoading(context, loadingContent??VFTextDelegateHelper.textDelegate.loading);
}
dynamic response = await HttpUtils.postJson(url, data: data, isNeedAllData: isNeedAllData);
// printWithSystemMethod("========拦截住===mixin==1=========$response");
if (response is AppException) {
// printWithSystemMethod("========拦截住===mixin==2=========");
AppException err = response;
List<int> notShowCode = co?.notShowToastCode ?? [];
if (isShowToast && !notShowCode.contains(err.getCode())) {
ToastUtils.toast(err.getMessage());
}
if (!notShowCode.contains(err.getCode())) {
hideLoading(context, isShowLoading);
}
return Future.error(response);
} else {
hideLoading(context, isShowLoading);
}
return response;
}