formatFileSize function
Formats a file size bytes into a human-readable string.
Implementation
String formatFileSize(int bytes) {
if (bytes >= 1024 * 1024) {
return '${(bytes / (1024 * 1024)).toStringAsFixed(2)} MB';
} else if (bytes >= 1024) {
return '${(bytes / 1024).toStringAsFixed(1)} KB';
} else {
return '$bytes B';
}
}