HttpFetcher.client constructor

HttpFetcher.client(
  1. Client client, {
  2. List<Uri>? endpoints,
  3. HttpValidator validator = _validate200OK,
})

A HTTP fetcher using the given HTTP client and optional endpoints.

An optional validator function handles how a HTTP response is converted to a HttpContent instance or thrown as HttpException. If not set, then only HTTP 200 OK responses are validated successful and returned as content.

Implementation

factory HttpFetcher.client(
  http.Client client, {
  List<Uri>? endpoints,
  HttpValidator validator = _validate200OK,
}) =>
    HttpFetcher._(
      HttpAdapter.client(client),
      null,
      _endpointResolver(endpoints),
      validator,
    );