formatSize method
Formate la taille en Ko ou Mo
Implementation
String formatSize(int bytes) {
if (bytes < 1024) {
return '$bytes B';
} else if (bytes < 1024 * 1024) {
return '${(bytes / 1024).toStringAsFixed(1)} KB';
} else {
return '${(bytes / (1024 * 1024)).toStringAsFixed(1)} MB';
}
}