DigiaImageCacheManager class final

The Digia-owned raster image disk cache.

Every raster picture the SDK draws goes through the loader-wide default: MediaImage and the preloads that share its entry (mediaImageProvider in the PiP orchestrator and the anchorless target layer). SDK init points that default here (see configureDigiaImageCache), so all three resolve to this one store.

The store is Digia's own, separate on both sides: the host app keeps the shared DefaultCacheManager (libCachedImageData, 200 objects / 30 days), and Lottie keeps its own digiaEngageLottie file cache. Nothing evicts anything else's files.

The cap is count-based because flutter_cache_manager has no byte cap: maxObjectsForBytes maps the server-driven byte budget to files at a ~2 MB average campaign picture. A byte store would mean leaving CachedNetworkImage, which is the only loader the render path trusts (gapless playback and error callbacks stay exactly as they were).

Constructors

DigiaImageCacheManager()
The process-wide manager. A second instance on the same cacheKey would open the same database twice, so there is exactly one — replaced only by configure, which points the loader default at the re-scaled store.
factory

Properties

config → Config
Get the config
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
store → CacheStore
Get the underlying store helper
no setterinherited
webHelper → WebHelper
Get the underlying web helper
no setterinherited

Methods

dispose() → Future<void>
Closes the cache database
inherited
downloadFile(String url, {String? key, Map<String, String>? authHeaders, bool force = false}) → Future<FileInfo>
Download the file and add to cache
inherited
emptyCache() → Future<void>
Removes all files from the cache
inherited
getFile(String url, {String? key, Map<String, String>? headers}) → Stream<FileInfo>
Get the file from the cache and/or online, depending on availability and age. Downloaded form url, headers can be used for example for authentication. The files are returned as stream. First the cached file if available, when the cached file is too old the newly downloaded file is returned afterwards.
inherited
getFileFromCache(String key, {bool ignoreMemCache = false}) → Future<FileInfo?>
Get the file from the cache. Specify ignoreMemCache to force a re-read from the database
inherited
getFileFromMemory(String key) → Future<FileInfo?>
Returns the file from memory if it has already been fetched
inherited
getFileStream(String url, {String? key, Map<String, String>? headers, bool withProgress = false}) → Stream<FileResponse>
Get the file from the cache and/or online, depending on availability and age. Downloaded form url, headers can be used for example for authentication. The files are returned as stream. First the cached file if available, when the cached file is too old the newly downloaded file is returned afterwards.
inherited
getSingleFile(String url, {String? key, Map<String, String>? headers}) → Future<File>
Get the file from the cache and/or online, depending on availability and age. Downloaded form url, headers can be used for example for authentication. When a file is cached and up to date it is return directly, when the cached file is too old the file is downloaded and returned after download. When a cached file is not available the newly downloaded file is returned.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
putFile(String url, Uint8List fileBytes, {String? key, String? eTag, Duration maxAge = const Duration(days: 30), String fileExtension = 'file'}) → Future<File>
Put a file in the cache. It is recommended to specify the eTag and the maxAge. When maxAge is passed and the eTag is not set the file will always be downloaded again. The fileExtension should be without a dot, for example "jpg". When cache info is available for the url that path is re-used. The returned File is saved on disk.
inherited
putFileStream(String url, Stream<List<int>> source, {String? key, String? eTag, Duration maxAge = const Duration(days: 30), String fileExtension = 'file'}) → Future<File>
Put a byte stream in the cache. When using an existing file you can use file.openRead(). It is recommended to specify the eTag and the maxAge. When maxAge is passed and the eTag is not set the file will always be downloaded again. The fileExtension should be without a dot, for example "jpg". When cache info is available for the url that path is re-used. The returned File is saved on disk.
inherited
removeFile(String key) → Future<void>
Remove a file from the cache
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

configure({required int imageDiskCacheBytes}) → void
Re-scales the owned store to imageDiskCacheBytes and points the loader default at it. A no-op when the object count is unchanged, so the defaults path never churns the store. The superseded manager is left for collection: same-key opens share one single-instance sqlite handle, so there is no second connection to close, and loads already in flight on the old manager finish against its files normally. (Closing it here would race its still-pending open and could drop those loads.)
maxObjectsForBytes(int bytes) → int
Maps a disk budget in bytes to the file cap, anchored so the default budget keeps maxNrOfCacheObjects files. flutter_cache_manager imposes no upper bound on the count, so there is no ceiling here — only a floor of one file against a degenerate zero/negative raw value (the resolved budget is already positive via SdkConfig).
resetForTesting() → void
Restores the default store. Tests only: keeps one custom-budget test from leaking its cap into the next.

Constants

bytesPerCacheObject → const int
Average campaign picture the object cap is sized at. 100 MB budgets exactly maxNrOfCacheObjects files.
cacheKey → const String
The sqflite/file-store key: the directory and database name. Distinct from the host's libCachedImageData and from digiaMedia. Never changes with the budget: a re-scaled store keeps its files.
maxNrOfCacheObjects → const int
At most this many files are kept by default; the least recently used go first. ~100 MB at a ~2 MB average campaign picture.
stalePeriod → const Duration
A file unused for this long is evicted on cleanup.