getCacheSize static method

Future<String> getCacheSize()

获取当前缓存大小。

Implementation

static Future<String> getCacheSize() async {
  final Directory tempDir = await getTemporaryDirectory();
  double size = 0.0;
  await for (final FileSystemEntity entity in tempDir.list()) {
    if (entity is File) {
      size += await entity.length();
    }
  }
  return formatMemorySize(size);
}