addCacheInterceptor method

void addCacheInterceptor(
  1. Interceptor cacheInterceptor
)

Add cache interceptor for offline support This should be called after cache is initialized

Implementation

void addCacheInterceptor(Interceptor cacheInterceptor) {
  if (!_cacheInterceptorAdded) {
    // Add cache interceptor after auth interceptor
    final insertIndex = _authInterceptorAdded ? 1 : 0;
    _dio.interceptors.insert(insertIndex, cacheInterceptor);
    _cacheInterceptorAdded = true;
    _logger.i('💾 Cache interceptor added for offline support');
  }
}