fetchText function

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

Fetch content body as text from a HTTP(S) resource identified by url.

Throws an ApiException if fetching fails. Also response status codes other than codes for success are thrown as exceptions.

Implementation

Future<String> fetchText(Uri url, {Map<String, String>? headers}) =>
    headers != null
        ? HttpFetcher.simple().headers(headers).fetchText(url)
        : HttpFetcher.simple().fetchText(url);