post method Null safety

Future<Response> post(
  1. Object body,
  2. {Map<String, dynamic>? headers}
)

Returns a Response object with the response from the server.

If the request fails, the Response object will have a null Response.body and Response.statusCode will be set to the status code of the error. Example:

Response response = await "https://example.com/api/v1/users".post(
                    {'name': 'John Doe'},
                    headers: {'content-type': 'application/json'})
                    .post();

Implementation

Future<Response> post(Object body, {Map<String, dynamic>? headers}) async {
  return await RequestHandler(this, body: body, headers: headers).post();
}