fetchBytes function

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

Fetch content body as bytes 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<Uint8List> fetchBytes(Uri url, {Map<String, String>? headers}) =>
    headers != null
        ? HttpFetcher.simple().headers(headers).fetchBytes(url)
        : HttpFetcher.simple().fetchBytes(url);