getCachedSizeBytes function

Future<int> getCachedSizeBytes()

Get total size of cached image

Implementation

Future<int> getCachedSizeBytes() async {
  int size = 0;
  final Directory cacheImagesDirectory = Directory(
      join((await getTemporaryDirectory()).path, cacheImageFolderName));
  if (cacheImagesDirectory.existsSync()) {
    await for (final FileSystemEntity file in cacheImagesDirectory.list()) {
      size += file.statSync().size;
    }
  }
  return size;
}