post<T> method

  1. @override
Future<T> post<T>(
  1. String path,
  2. {Object? body,
  3. Map<String, dynamic>? queryParameters,
  4. Options? options}
)
override

Performs a POST request to the provided API URL with the given body and returns the response.

  • path: The URL for the POST request.
  • body: (optional) The request body.
  • queryParameters: (optional) The query parameters for the POST request.
  • options: (optional) The options to be merged with the base options.

Returns a Future that completes with the response data of type T.

Throws a DioException if the request fails.

Implementation

@override
Future<T> post<T>(String path,
    {Object? body,
    Map<String, dynamic>? queryParameters,
    Options? options}) async {
  try {
    final response = await _dio.post<T>(path,
        data: body, queryParameters: queryParameters, options: options);
    return response.data as T;
  } on DioException catch (e) {
    log("message: ${e.message}");
    rethrow;
  }
}