CacheManagerHelper class

Helper class for cache management operations Wraps flutter_cache_manager functionality with Singleton pattern and optimized configuration for production use.

Constructors

CacheManagerHelper()
factory

Properties

cacheManager → CacheManager
Get the active CacheManager instance Auto-initializes with default config on first use if not explicitly initialized
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearAllCache() Future<void>
Clear all cached images
downloadFile(String url, {Map<String, String>? headers}) Future<FileInfo>
Download file and put in cache
getFileFromCache(String url) Future<FileInfo?>
Get file from cache
getSingleFile(String url, {Map<String, String>? headers}) Future<File>
Get file from cache or download if not available
initialize({String cacheKey = _key, Duration stalePeriod = _stalePeriod, int maxNrOfCacheObjects = _maxNrOfCacheObjects}) → void
Initialize the CacheManager with custom configuration cacheKey - Unique key for the cache stalePeriod - Duration before a cache object is considered stale maxNrOfCacheObjects - Maximum number of objects to keep in cache
isImageCached(String url) Future<bool>
Check if image exists in cache
logCacheInfo() → void
Get cache information (Debug only)
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
preloadImage(String url) Future<void>
Download and cache image without displaying (Prefetch)
removeImageFromCache(String url) Future<void>
Remove specific image from cache
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance → CacheManager
Static access to the singleton's cacheManager
no setter

Static Methods

clearAll() Future<void>
isCached(String url) Future<bool>
prefetch(String url) Future<void>
removeFile(String url) Future<void>