HttpCacheClient constructor

HttpCacheClient({
  1. required String baseUrl,
  2. Duration cacheTimeout = const Duration(minutes: 5),
  3. KeyGenerator? keyGenerator,
  4. Client? httpClient,
})

Creates a new HTTP client with caching support.

  • baseUrl: The base URL for all requests
  • cacheTimeout: How long cached responses remain valid (default: 5 minutes)
  • keyGenerator: Optional custom cache key generator
  • httpClient: Optional custom HTTP client implementation

Implementation

HttpCacheClient(
    {required this.baseUrl,
    this.cacheTimeout = const Duration(minutes: 5),
    KeyGenerator? keyGenerator,
    http.Client? httpClient})
    : _keyGenerator = keyGenerator ?? const DefaultKeyGenerator(),
      _httpClient = httpClient ?? http.Client();