percentFormat property

String get percentFormat

百分比格式化方法。

将整数视为比率并乘以 100:1.percentFormat → "100%", 25.percentFormat → "2500%"。

注意:this! * 100 为整数运算,对于接近 int64 上限的输入 (约 9.2e18)可能发生静默溢出。如需对极大整数做百分比格式化, 请先转 double 或使用 Decimal。

Implementation

String get percentFormat {
  if (this == null) return '0%';
  return '${this! * 100}%';
}