jsonRequest method

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

Implementation

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

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