postToDB function
helper methods for http requests
Implementation
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),
);
print(response.body);
return jsonDecode(response.body);
}