loadCache function

Future<String> loadCache()

加载缓存 缓存文件大小的字符串, 携带单位(B, K, M, G, T)

Implementation

Future<String> loadCache() async {
  try {
    final Directory tempDir = await getTemporaryDirectory();
    final double value = await _getTotalSizeOfFilesInDir(tempDir);
    /*tempDir.list(followLinks: false,recursive: true).listen((file){
      //打印每个缓存文件的路径
      print(file.path);
    });*/
    // print('临时目录大小: ' + value.toString());
    return _renderSize(value);
  } catch (err) {
    print('获取缓存异常: $err');
    return '0.00B';
  }
}