numToString function

String numToString (num n)

Convert n to String, without decimal .0 if possible if n == 0.1 returns '0.1' if n == 0.0 returns '0'

Implementation

String numToString(num n) {
  final int i = n.toInt();
  return (n == i) ? i.toString() : n.toString();
}