getDerivedDataSizeBytes method

Future<int?> getDerivedDataSizeBytes()

Disk usage of Derived Data in bytes, or null if missing / unreadable.

Implementation

Future<int?> getDerivedDataSizeBytes() async {
  if (!Platform.isMacOS) return null;
  final path = derivedDataPath;
  if (path == null) return null;
  try {
    final result = await _exec.run('du', arguments: ['-sk', path]);
    if (!result.success) return null;
    final line = result.stdout.trim();
    if (line.isEmpty) return null;
    final kbToken = line.split(RegExp(r'\s+')).first;
    final kb = int.tryParse(kbToken);
    if (kb == null) return null;
    return kb * 1024;
  } catch (_) {
    return null;
  }
}