diff --git a/flutter_cache_manager/lib/src/cache_store.dart b/flutter_cache_manager/lib/src/cache_store.dart index cb90ae2d..3ad735ac 100644 --- a/flutter_cache_manager/lib/src/cache_store.dart +++ b/flutter_cache_manager/lib/src/cache_store.dart @@ -202,4 +202,14 @@ class CacheStore { final provider = await _cacheInfoRepository; await provider.close(); } + + Future getCacheSize() async { + final provider = await _cacheInfoRepository; + final allObjects = await provider.getAllObjects(); + int total = 0; + for (var cacheObject in allObjects) { + total += cacheObject.length ?? 0; + } + return total; + } }