putOnDB function

Future<Map> putOnDB({
  1. required String api,
  2. required String apiKey,
  3. required Map body,
})

Generic Put function to make Put API calls

Implementation

Future<Map> putOnDB(
    {required String api, required String apiKey, required Map body}) async {
  final http.Response response = await http.put(Uri.parse(api),
      headers: <String, String>{
        'Content-Type': 'application/json',
        'X-CC-Version': '2018-03-22',
        'X-CC-Api-Key': apiKey,
      },
      body: jsonEncode(body));
  return jsonDecode(response.body);
}