size method
Calculates the total size of the cache in bytes.
Returns the sum of the sizes of all files in the cache directory. Returns 0 on web platform.
Implementation
Future<int> size() async {
if (!isAvailable) return 0;
int totalSize = 0;
await for (var file in _cacheDirectory!.list(
recursive: true,
followLinks: false,
)) {
if (file is File) {
totalSize += await file.length();
}
}
return totalSize;
}