Future fetchJSON(String url, { Map<String, String> headers })

Fetches the specified url from HTTP as JSON. If headers is specified, the headers will be added onto the request.

Source

static Future<dynamic> fetchJSON(String url, {Map<String, String> headers}) async {
  return const JsonDecoder().convert(await fetchUrl(url, headers: headers));
}