post method

Future post({
  1. required String url,
  2. required Object? body,
  3. Map<String, String>? header,
})

POST

Implementation

Future<dynamic> post({required String url, required Object? body, Map<String, String>? header}) async {
  dynamic responseJson;
  try {
    final response = await http.post(Uri.parse(url), headers: headers ?? header, body: body);
    responseJson = _returnResponse(response);
  } on SocketException {
    throw FetchDataException('No Internet connection');
  }
  return responseJson;
}