postApi<T> method

Future<T> postApi<T>(
  1. Uri uri,
  2. dynamic body,
  3. T mapperFunction(
    1. dynamic value
    ), {
  4. Map<String, String>? headers,
})

Implementation

Future<T> postApi<T>(
  Uri uri,
  dynamic body,
  T Function(dynamic value) mapperFunction, {
  Map<String, String>? headers,
}) async {
  headers = getHeaders(headers ?? {});
  var newBody = getRequestBody(body);
  log(newBody, name: 'requestBody');
  var caller = client
      .post(
        uri,
        body: newBody,
        headers: headers,
      )
      .timeout(timeout);
  return _callApi(caller, mapperFunction);
}