httpPost method

Future<Response> httpPost({
  1. String? url,
  2. String? requestBody,
  3. Map<String, String>? headers,
})

Implementation

Future<http.Response> httpPost({
  String? url,
  String? requestBody,
  Map<String, String>? headers,
}) async {
  print('Request body:' + requestBody!);
  var response = await http.post(Uri.parse(url!),
      body: requestBody,
      headers: headers ??
          {
            HttpHeaders.contentTypeHeader: "application/json",
          });
  print('Response body:' + response.body);
  return response;
}