reworked developer tools with diagnostics, storage viewers and release-capable debug overlays
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import 'dart:io';
|
||||
|
||||
/// Total byte size of all files below [dir]; `0` when it doesn't exist or
|
||||
/// can't be listed.
|
||||
Future<int> directorySize(Directory dir) async {
|
||||
var sum = 0;
|
||||
try {
|
||||
if (!dir.existsSync()) return 0;
|
||||
await for (final entity in dir.list(recursive: true, followLinks: false)) {
|
||||
if (entity is File) sum += await entity.length();
|
||||
}
|
||||
} on FileSystemException {
|
||||
// Files can vanish mid-walk (cache pruning); report what was counted.
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
Reference in New Issue
Block a user