post function

Future<Result> post({
  1. String? baseUrl,
  2. String path = '',
  3. dynamic data,
  4. Map<String, dynamic>? queryParameters,
  5. Duration? connectTimeout,
  6. BaseCancelToken? cancelToken,
  7. ProgressCallback? onSendProgress,
  8. ProgressCallback? onReceiveProgress,
  9. bool validResult = true,
  10. bool autoLoading = false,
})

发送请求并解析远程服务器返回的result对应的实体类型

baseUrl: 主机地址 path: 请求路径 data: 请求参数 queryParameters: URL携带请求参数 connectTimeout: 超时时间 validResult: 是否检验返回结果 autoLoading: 展示Loading

Implementation

Future<Result> post(
    {String? baseUrl,
    String path = '',
    data,
    Map<String, dynamic>? queryParameters,
    Duration? connectTimeout,
    BaseCancelToken? cancelToken,
    ProgressCallback? onSendProgress,
    ProgressCallback? onReceiveProgress,
    bool validResult = true,
    bool autoLoading = false}) async {
  return request(
      baseUrl: baseUrl,
      path: path,
      data: data,
      queryParameters: queryParameters,
      options: Options(method: 'post'),
      connectTimeout: connectTimeout,
      cancelToken: cancelToken,
      onSendProgress: onSendProgress,
      onReceiveProgress: onReceiveProgress,
      validResult: validResult,
      autoLoading: autoLoading);
}