jsonRequest method

Future<Map<String, dynamic>> jsonRequest(
  1. String url
)

make a get request to the given url

Implementation

Future<Map<String, dynamic>> jsonRequest(String url) async {
  http.Response response = await _client.get(
      Uri.parse(url).replace(scheme: 'https'),
      headers: {"Accept": "application/json"});

  if (response.statusCode != 200) {
    return throw Exception(
        "error fetching STATUS: ${response.statusCode}, Link: $url");
  }
  return jsonDecode(response.body);
}