postx<T> method

Future<Response> postx<T>(
  1. String path, {
  2. Map<String, String>? headers,
  3. Object? body,
})

Implementation

Future<Response> postx<T>(String path,
    {Map<String, String>? headers, Object? body}) async {
  try {
    if (headers != null) {
      headers = Map.from(headers)..addAll(headerDefault);
    } else {
      headers = headerDefault;
    }

    var response = await post(Uri.parse(path), headers: headers, body: body);
    return Future.value(response);
  } on FormatException catch (_) {
    throw const FormatException("Unable to process the data");
  } catch (e) {
    throw e.toString();
  }
}