convertToString static method
Implementation
static String convertToString(num value, {int decimalPlaces = 2}) {
if (value == value.toInt()) {
return value.toInt().toString();
} else {
return value.toStringAsFixed(decimalPlaces); // 保留指定的小数位数
}
}