formatSize static method
Implementation
static String formatSize(double? value) {
if (null == value) {
return '0B';
}
List<String> unitArr = ['B', 'K', 'M', 'G'];
int index = 0;
while (value! > 1024) {
index++;
value = value / 1024;
}
String size = value.toStringAsFixed(2);
return size + unitArr[index];
}