cacheSize method

Future<int> cacheSize(
  1. String diskCacheDirName
)

Implementation

Future<int> cacheSize(String diskCacheDirName) async {
  int size = 0;
  try {
    Directory localDir = await _getLocalDir(diskCacheDirName);
    if (localDir.existsSync())
      localDir.listSync().forEach((var file) {
        size += file.statSync().size;
      });

    return size;
  } catch (e) {
    print(e);
  }

  return -1;
}