DefaultCacheManager class

Default cache manager implementation using Hive CE for metadata storage, the http package for downloads, and path_provider for file system access.

Inheritance
Mixed-in types

Constructors

DefaultCacheManager({Duration stalePeriod = _kDefaultStalePeriod, int maxNrOfCacheObjects = _kDefaultMaxCacheObjects, Client httpClientFactory()?, CacheDirectoryProvider? cacheDirectoryProvider})
Creates a DefaultCacheManager with optional configuration.

Properties

hashCode int
The hash code for this object.
no setterinherited
maxNrOfCacheObjects int
Maximum number of objects in the cache before cleanup.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stalePeriod Duration
Duration before cached files are considered stale.
final

Methods

dispose() Future<void>
Close the cache database.
override
emptyCache() Future<void>
Remove all files from the cache.
override
getFileFromCache(String key, {bool ignoreMemCache = false}) Future<FileInfo?>
Get the file from the cache.
override
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.
override
getImageFile(String url, {String? key, Map<String, String>? headers, bool withProgress = false, int? maxHeight, int? maxWidth}) Stream<FileResponse>
Returns a resized image file to fit within maxHeight and maxWidth.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
putFile(String url, List<int> fileBytes, {String? key, String? eTag, Duration maxAge = _kDefaultMaxAge, String fileExtension = 'file'}) Future<File>
Put a file in the cache.
override
removeFile(String key) Future<void>
Remove a file from the cache.
override
toString() String
A string representation of this object.
inherited

Operators

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