currencyFormat property

String get currencyFormat

金额格式化处理(输入单位为分,恒定输出两位小数,且去掉无意义的 末尾 0:1500 → "15" 而非 "15.00")。null 返回 "0.0"。

Implementation

String get currencyFormat {
  if (this == null) {
    return '0.0';
  }
  final num = (this! / 100).toStringAsFixed(2);
  return Decimal.parse(num).toString();
}