humanReadableSize property

String get humanReadableSize

Implementation

String get humanReadableSize {
  if (totalBytes < 1024) return '$totalBytes B';
  if (totalBytes < 1024 * 1024) {
    return '${(totalBytes / 1024).toStringAsFixed(1)} KB';
  }
  if (totalBytes < 1024 * 1024 * 1024) {
    return '${(totalBytes / (1024 * 1024)).toStringAsFixed(1)} MB';
  }
  return '${(totalBytes / (1024 * 1024 * 1024)).toStringAsFixed(1)} GB';
}