fetchJSON static method

Future fetchJSON(
  1. String url, {
  2. Map<String, String>? headers,
})

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

Implementation

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