WebCacheService class

Web cache service

Coordinates caching using:

  • Cache API: Binary model data storage
  • SharedPreferences: Metadata storage
  • Blob URLs: Created on-demand from cached data

Constructors

WebCacheService(WebCacheInterop _cacheInterop, SharedPreferences _prefs, WebFileSystemService _fileSystem, {bool enableCache = true})

Properties

enableCache bool
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

cacheModel(String url, Uint8List data) Future<void>
Cache a model
clearCache() Future<void>
Clear all cache
getCachedBlobUrl(String url) Future<String?>
Get cached blob URL
getCachedUrls() Future<List<String>>
Get all cached URLs
getOrCacheAndRegister({required String cacheKey, required Future<Uint8List> loader(), required String targetPath}) Future<String>
Simple version without progress tracking
getOrCacheAndRegisterWithProgress({required String cacheKey, required Future<Uint8List> loader(void onProgress(double)), required String targetPath}) Stream<int>
Universal caching wrapper with progress tracking (stream version)
getStorageQuota() Future<StorageQuota>
Get storage quota information
isCached(String url) Future<bool>
Check if a URL is cached
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requestPersistentStorage() Future<bool>
Request persistent storage
toString() String
A string representation of this object.
inherited

Operators

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

Constants

cacheName → const String
Cache name for models
maxCacheAge → const Duration
Maximum cache age before cleanup (30 days)