renderSize static method
Implementation
static String renderSize(double value, [fix = 2]) {
// ignore: unnecessary_null_comparison
if (value == null) {
return '0.0';
}
List<String> unitArr = []
..add('B')
..add('K')
..add('M')
..add('G');
int index = 0;
while (value > 1024) {
index++;
value = value / 1024;
}
String size = value.toStringAsFixed(fix);
return size + unitArr[index];
}