DoubleFormating extension

  • @Author: chuxiong
  • @Created at: 2023/3/2 4:04 下午
  • @Email:
  • @Company: 嘉联支付
  • description double 扩展 依赖:decimal(纯 Dart,金额格式化用)。
on

Properties

currencyFormat → String

Available on double?, provided by the DoubleFormating extension

分转元并格式化(输入单位为分,恒定输出两位小数)。
no setter
defaultValue → double

Available on double?, provided by the DoubleFormating extension

默认值格式化(safeValue 的语义化别名)。
no setter
isNegative → bool

Available on double?, provided by the DoubleFormating extension

数值比较:是否为负数(< 0)。
no setter
isNullOrEmpty → bool

Available on double?, provided by the DoubleFormating extension

空值判断:是否为 null(注意 0.0 不算空)。
no setter
isPositive → bool

Available on double?, provided by the DoubleFormating extension

数值比较:是否为正数(> 0)。
no setter
isZero → bool

Available on double?, provided by the DoubleFormating extension

数值比较:是否为零(== 0)。
no setter
safeValue → double

Available on double?, provided by the DoubleFormating extension

安全取值:null → 0.0。
no setter
thousandSeparated → String

Available on double?, provided by the DoubleFormating extension

no setter

Methods

add(double other) → double

Available on double?, provided by the DoubleFormating extension

数学运算:相加(普通浮点运算,有精度风险;如需精确请用 NumUtils.addNum)。
divideBy(double divisor) → double

Available on double?, provided by the DoubleFormating extension

数学运算:相除。除数为 0 时返回 0.0(不抛异常);如需精确或显式报错请用 NumUtils.divideNum。
formatDoubleComma3({int digit = 3, String pattern = ','}) → String

Available on double?, provided by the DoubleFormating extension

千分位格式化(保留原始小数位)。
moneyFormatWithUnit(bool autoMoneyUnit) → String

Available on double?, provided by the DoubleFormating extension

带单位格式化(输入单位为分)。
multiplyBy(double factor) → double

Available on double?, provided by the DoubleFormating extension

数学运算:相乘(普通浮点运算;如需精确请用 NumUtils.multiplyNum)。
percentFormat([int fractionDigits = 2]) → String

Available on double?, provided by the DoubleFormating extension

百分比格式化。
subtract(double other) → double

Available on double?, provided by the DoubleFormating extension

数学运算:相减(普通浮点运算;如需精确请用 NumUtils.subtractNum)。