formatSessionBytes function
Human-readable byte count for the backstop error (GiB/MB granularity).
Implementation
String formatSessionBytes(int bytes) {
if (bytes >= (1 << 30)) {
return '${(bytes / (1 << 30)).toStringAsFixed(1)} GiB';
}
if (bytes >= (1 << 20)) {
return '${(bytes / (1 << 20)).toStringAsFixed(1)} MB';
}
return '$bytes bytes';
}