DioInterceptorExtension extension

Extension on Dio that provides convenient methods for adding common interceptors.

This extension simplifies the process of adding frequently used interceptors to Dio instances, with platform-specific behavior for web and native platforms.

Usage Example:

final dio = Dio();
dio.addCookieStorageInterceptor(); // Adds cookie management (native only)
dio.addBaseUrlInterceptor();       // Adds persistent URL handling (native only)
on
  • Dio

Methods

addBaseUrlInterceptor() → void

Available on Dio, provided by the DioInterceptorExtension extension

Adds a base URL interceptor to the Dio instance.
addCookieStorageInterceptor() → void

Available on Dio, provided by the DioInterceptorExtension extension

Adds a cookie storage interceptor to the Dio instance.