createHttpClient top-level property

ValueGetter<Client> createHttpClient
read / write

(Deprecated, use dart:io.HttpClientOverrides) Create a new http.Client object.

We recommend dart:io.HttpClientOverrides instead of this function. Flutter will soon use dart:io.HttpClient.

This can be set to a new function to override the default logic for creating HTTP clients, for example so that all logic in the framework that triggers HTTP requests will use the same UserAgent header, or so that tests can provide an http.testing.MockClient.

Implementation

ValueGetter<http.Client> createHttpClient = () {
  return new http.Client();
}