formattedSize property

String get formattedSize

Formatted human-readable file size (e.g. "2.4 MB").

Implementation

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