formatInt function

String formatInt(
  1. dynamic number, {
  2. dynamic nullTxt = "-",
})

Implementation

String formatInt(number, {nullTxt = "-"}) {
  if (number == null || number == "") {
    return nullTxt;
  }
  int num;
  try {
    num = int.parse(number.toString());
  } catch (e) {
    loggerNoStack.i("转换异常:$e");
    return nullTxt;
  }
  return num.toString();
}