getFromDB function

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

Generic Get function to make Get API calls

Implementation

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