formatNum function
Implementation
formatNum(double num, int postion) {
if ((num.toString().length - num.toString().lastIndexOf(".") - 1) < postion) {
//小数点后有几位小数
print(num.toStringAsFixed(postion).substring(0, num.toString().lastIndexOf(".") + postion + 1).toString());
} else {
print(num.toString().substring(0, num.toString().lastIndexOf(".") + postion + 1).toString());
}
}