k_request function
基础数据处理,自定义处理返回数据类型
Implementation
Future<dynamic> k_request(Future<Response> Function() request) async {
try {
var response = await request();
if (response.statusCode == HttpStatus.ok) {
return response.data;
} else {
KHttpPlatform.get.throwHandler
?.handleStatusCode(response.statusCode, response.data);
}
} on Exception catch (ex) {
KHttpPlatform.get.throwHandler?.handleError(ex);
}
}