cacheSize method

Future<int> cacheSize()

Total size of cached fonts in bytes.

Implementation

Future<int> cacheSize() async {
  final dir = await getCacheDir();
  if (!dir.existsSync()) return 0;
  int total = 0;
  await for (final entity in dir.list()) {
    if (entity is File) {
      total += await entity.length();
    }
  }
  return total;
}