createDioInstance method

Dio createDioInstance()

Creates and returns a Dio instance that's pre-configured with caching capabilities.

Uses the DioCacheInterceptor to provide caching functionality, relying on the cache configurations provided in _defaultCacheOptions.

Implementation

Dio createDioInstance() {
  Dio dio = Dio();

  // Integrate cache interceptor if caching is enabled in configurations
  if (DioCacheConfiguration.useCacheInterceptor) {
    dio.interceptors.add(DioCacheInterceptor(options: _defaultCacheOptions));
  }

  return dio;
}