post method

Future post(
  1. String model,
  2. String body, {
  3. Map<String, String>? customHeaders,
  4. String pageId = "1",
  5. String pageSize = "0",
  6. String contentType = "application/json",
})

POST Request

Implementation

Future<dynamic> post(String model, String body,
    {Map<String, String>? customHeaders,
    String pageId = "1",
    String pageSize = "0",
    String contentType = "application/json"}) async {
  http.Response response;

  try {
    response = await client.post(
      generateEndpointUrl(model),
      headers: generateHeader(
          customHeaders: customHeaders,
          pageId: pageId,
          pageSize: pageSize,
          contentType: contentType),
      body: body,
    );
  } catch (e) {
    throw Exception("Unable to make POST request. ${e.toString()}");
  }

  return response;
}