number static method

String number(
  1. double value
)

Implementation

static String number(double value) {
  if (value == value.roundToDouble()) return '${value.round()}';
  var text = value.toStringAsFixed(2);
  while (text.endsWith('0')) {
    text = text.substring(0, text.length - 1);
  }
  if (text.endsWith('.')) text = text.substring(0, text.length - 1);
  return text;
}