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.

The instance is cached and reused unless the configuration has changed.

Implementation

Dio createDioInstance() {
  // Check if we need to recreate the Dio instance due to configuration changes
  if (_dioInstance == null || _hasConfigChanged()) {
    _dioInstance = _createNewDioInstance();
  }

  return _dioInstance!;
}