fetchUrl static method

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

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

Implementation

static Future<String> fetchUrl(
  String url, {
  Map<String, String>? headers,
}) async {
  var request = await createRequest('GET', url, headers: headers);
  var response = await request.close();
  return const Utf8Decoder().convert(await readBytesFromResponse(response));
}