I made regular expression pattern for that feature.
double num = 12.50; //12.5
double num2 = 12.0; //12
double num3 = 1000; //1000
RegExp regex = RegExp(r"([.]*0)(?!.*d)");
String s = num.toString().replaceAll(regex), "");
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…