asFileSize property
String
get
asFileSize
Format as file size (bytes to KB/MB/GB)
Implementation
String get asFileSize {
if (this < 1024) return '${this.toStringAsFixed(0)} B';
if (this < 1024 * 1024) return '${(this / 1024).toStringAsFixed(1)} KB';
if (this < 1024 * 1024 * 1024) {
return '${(this / (1024 * 1024)).toStringAsFixed(1)} MB';
}
return '${(this / (1024 * 1024 * 1024)).toStringAsFixed(1)} GB';
}