post method

Future<Response?> post(
  1. String apiPath, {
  2. required String body,
})

Implementation

Future<Response?> post(String apiPath, {required String body}) async {
  try {
    _setMiddleWares();

    Uri uri = Uri.parse(apiPath);
    if (uri.scheme == "https")
      uri = Uri.https(uri.authority, uri.path);
    else
      uri = Uri.http(uri.authority, uri.path);

    final Response response =
        await _client.post(uri, body: body, headers: map);

    return response;
  } catch (e) {
    print("post req Failed $e");
  }
}