post method

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

Implementation

Future<http.Response?> post(
  String apiPath, {
  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 = await http.post(uri, body: body, headers: map);
    // .timeout(_timeout, onTimeout: _timeoutFunc);

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