post method

Future post(
  1. String uri, {
  2. dynamic data,
  3. Map<String, dynamic>? queryParameters,
  4. Future<Map<String, dynamic>>? headers,
  5. CancelToken? cancelToken,
  6. ProgressCallback? onSendProgress,
  7. ProgressCallback? onReceiveProgress,
})

Implementation

Future<dynamic> post(
  String uri, {
  data,
  Map<String, dynamic>? queryParameters,
  Future<Map<String, dynamic>>? headers,
  CancelToken? cancelToken,
  ProgressCallback? onSendProgress,
  ProgressCallback? onReceiveProgress,
}) async {
  try {
    final Response response = await _dio.post(
      uri,
      data: data,
      queryParameters: queryParameters,
      options: Options(
        contentType: Headers.jsonContentType,
        headers: await headers,
      ),
      cancelToken: cancelToken,
      onSendProgress: onSendProgress,
      onReceiveProgress: onReceiveProgress,
    );
    return response.data;
  } on DioError catch (e) {
    final exeception = await _apiErrorHandler(e);
    throw exeception;
  }
}