CachedManager<M> class abstract

An abstract class responsible for managing cached files in the application.

The CacheManager<T> provides the contract for caching images and other assets locally to enhance performance and reduce redundant network requests. It defines methods for retrieving local files, cache cleanup, and pre-caching assets.

Subclasses should implement platform-specific caching mechanisms.

Properties:

  • cacheCleanupThreshold (Duration):
    • The duration after which cached files are considered stale and eligible for deletion. Default is set to 7 days.

Methods:

  • CacheManager({Duration cacheCleanupThreshold}):

    • Constructs an instance of the CacheManager class with an optional cache cleanup threshold.
  • Future<T> getLocalFile(String url):

    • Retrieves a local file corresponding to the specified URL.
  • Future<void> preCacheAsset(String assetPath):

    • Pre-caches an asset from the application's bundle into the temporary directory.
Implementers

Constructors

CachedManager({Duration cacheCleanupThreshold = const Duration(days: 7)})
Constructs an instance of the CachedManager class with an optional cacheCleanupThreshold.

Properties

cacheCleanupThreshold Duration
The duration after which cached files are considered stale and eligible for deletion.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getLocalFile(String url) Future<M>
Retrieves a local file corresponding to the specified url.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
preCacheAsset(String assetPath) Future<void>
Pre-caches an asset from the application's bundle into the temporary directory.
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

getInstance({Duration? cacheCleanupThreshold}) CachedManager
Static method to get the appropriate CacheManager instance based on the platform.