dirSize static method
Implementation
static int dirSize(String dirPath) {
int totalSize = 0;
var dir = Directory(dirPath);
try {
if (dir.existsSync()) {
dir.listSync(recursive: true, followLinks: false).forEach((FileSystemEntity entity) {
if (entity is File) {
totalSize += entity.lengthSync();
}
});
}
} catch (e) {
debugPrint(e.toString());
}
return totalSize;
}