postToDB function
helper methods for http requests TODO: Map httpCalls to Singleton Class Generic Post function to make Post API calls
Implementation
///Generic Post function to make Post API calls
Future<Map> postToDB(
{required String api,
required String apiKey,
required Map<String, dynamic> body,
Map<String, String>? headers}) async {
final http.Response response = await http.post(
Uri.parse(api),
headers: {
'Content-Type': 'application/json',
'X-CC-Version': '2018-03-22',
'X-CC-Api-Key': apiKey,
},
body: jsonEncode(body),
);
return jsonDecode(response.body);
}