post<T> method

Future<HttpResponse<T>> post<T>(
  1. String uri,
  2. {dynamic data,
  3. Map<String, dynamic>? queryParameters,
  4. Options? options,
  5. CancelToken? cancelToken,
  6. ProgressCallback? onSendProgress,
  7. ProgressCallback? onReceiveProgress,
  8. HttpTransformer? httpTransformer,
  9. bool isShowLoading = true}
)

Implementation

Future<HttpResponse<T>> post<T>(String uri,
    {data,
      Map<String, dynamic>? queryParameters,
      dio.Options? options,
      dio.CancelToken? cancelToken,
      dio.ProgressCallback? onSendProgress,
      dio.ProgressCallback? onReceiveProgress,
      HttpTransformer? httpTransformer,
      bool isShowLoading = true}) async {
  try {
    if(isShowLoading) EasyLoading.show(status: 'loading...');
    var response = await _dio.post(
      uri,
      data: data,
      queryParameters: queryParameters,
      options: options,
      cancelToken: cancelToken,
      onSendProgress: onSendProgress,
      onReceiveProgress: onReceiveProgress,
    );
    if(isShowLoading) EasyLoading.dismiss();
    return handleResponse(response, httpTransformer: httpTransformer);
  } on Exception catch (e) {
    if(isShowLoading) EasyLoading.dismiss();
    return handleException(e);
  }
}