getCachedSizeBytes function Null safety

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()) {
    for (final FileSystemEntity file in cacheImagesDirectory.listSync()) {
      size += file.statSync().size;
    }
  }
  return size;
}