DioImageProvider constructor
Creates a new DioImageProvider instance.
The provider will attempt to load the image from imageUrl first. If that fails
for any reason (network error, invalid response, etc.), it will automatically
fall back to loading the image from fallbackAssetPath.
The internal Dio instance is automatically configured with the following interceptors:
- DeviceInfoInterceptor: Adds device information to requests
- TimezoneInterceptor: Adds timezone information to requests
- RefreshInterceptor: Handles token refresh logic
- Cookie storage interceptor (on non-web platforms only)
Parameters:
imageUrl: The network URL of the image to loadfallbackAssetPath: The asset path to use if the network image fails to load
Implementation
DioImageProvider({
required this.imageUrl,
required this.fallbackAssetPath,
}) : dio = Dio() {
if (!kIsWeb) {
dio.interceptors.add(
SupaArchitecturePlatform.instance.cookieStorage.interceptor,
);
}
dio.interceptors.add(DeviceInfoInterceptor());
dio.interceptors.add(TimezoneInterceptor());
dio.interceptors.add(RefreshInterceptor());
}