post static method

Future<Map<String, dynamic>?> post(
  1. String url, {
  2. Map<String, dynamic>? params,
})

post请求,json编码

Implementation

static Future<Map<String,dynamic>?> post(
  String url, {Map<String, dynamic>? params}
) async {
  try {
    assetDio();
    var result = await _dio!.post(url, data: params);
    var data = ObjectUtil.isEmpty(result.data) ? <String, dynamic>{} : result.data;
    return result.isSuccessful ? data : null;
  } on DioException catch (e) {
    return _convertException(e, url, params: params);
  } on SocketException catch (e) {
    return _convertException(e, url, params: params);
  }
}