config method

void config({
  1. Duration timeout = const Duration(seconds: 60),
  2. bool networkFirst = true,
  3. Map<String, String>? headers,
  4. String? baseURL,
})

Override ExtendedHttp config

timeout -- Request timeout, default 60 seconds.

networkFirst -- If true, fetch data from network first, then if failed, try get from cache. Versa if false. Only work with GET requests, default true.

headers -- Custom request headers.

Implementation

void config({
  Duration timeout = const Duration(seconds: 60),
  bool networkFirst = true,
  Map<String, String>? headers,
  String? baseURL,
}) {
  _networkFirst = networkFirst;
  _timeout = timeout;
  if (headers != null) {
    _headers = headers;
  }
  if (baseURL != null) {
    _baseURL = baseURL;
  }
}