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