bytes static method
Implementation
static String bytes(int b) {
if (b <= 0) return '0 B';
if (b < 1024) return '$b B';
if (b < 1024 * 1024) return '${(b / 1024).toStringAsFixed(1)} KB';
if (b < 1024 * 1024 * 1024) {
return '${(b / 1024 / 1024).toStringAsFixed(1)} MB';
}
return '${(b / 1024 / 1024 / 1024).toStringAsFixed(2)} GB';
}