sizeFormatted method
Gets the file size as a formatted string (e.g., "1.2 MB").
Implementation
String sizeFormatted() {
const suffixes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
if (sizeBytes <= 0) return '0 B';
var i = (log(sizeBytes) / log(1024)).floor().clamp(0, suffixes.length - 1);
return '${(sizeBytes / pow(1024, i)).toStringAsFixed(2)} ${suffixes[i]}';
}