NumUtils class

Constructors

NumUtils()
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addDec(num a, num b) → Decimal?
加 (精确相加,防止精度丢失). add (without loosing precision).
addDecString(String a, String b) → Decimal?
两个数相加(防止精度丢失)
addNum(num a, num b) → double
add (without loosing precision). 两个数相加(防止精度丢失)
divideDec(num a, num b) → Decimal?
除 (精确相除,防止精度丢失). divide (without loosing precision).
divideDecString(String a, String b) → Decimal?
除
divideNum(num a, num b) → double
divide (without loosing precision). 两个数相除(防止精度丢失)
getDoubleByValueString(String valueStr, {double defValue = 0}) → double
get double by value str. 数字字符串转double
getIntByValueString(String valueStr, {int defValue = 0}) → int
get int by value string 将数字字符串转int
getNumByValueDouble(double? value, int fractionDigits) → num?
浮点数字保留x位小数
getNumByValueString(String valueStr, {int? fractionDigits}) → num?
将数字字符串转num,数字保留x位小数
greaterOrEqual(num a, num b) → bool
Relational greater than or equal operator.
greaterOrEqualDecString(String a, String b) → bool
Relational greater than or equal operator.
greaterThan(num a, num b) → bool
Relational greater than operator. 关系大于运算符。判断a是否大于b
greaterThanDecString(String a, String b) → bool
Relational greater than operator. 判断a是否大于b
isEqual(num a, num b) → bool
Checks if num a EQUAL than num b. 检查num a是否等于num b。
isGreaterThan(num a, num b) → bool
Checks if num a GREATER than num b. 检查num a是否大于num b。
isLowerThan(num a, num b) → bool
Checks if num a LOWER than num b. 检查num a是否小于num b。
isNum(String s) → bool
Checks if string is int or double. 检查字符串是int还是double
isZero(num? value) → bool
isZero 判断是否是否是0
lessThan(num a, num b) → bool
Relational less than operator. 关系小于运算符。判断a是否小于b
lessThanDecString(String a, String b) → bool
Relational less than operator. 判断a是否小于b
multiplyDec(num a, num b) → Decimal?
乘 (精确相乘,防止精度丢失). multiply (without loosing precision).
multiplyDecString(String a, String b) → Decimal?
乘
multiplyNum(num a, num b) → double
multiply (without loosing precision). 两个数相乘(防止精度丢失)
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remainder(num a, num b) → Decimal?
余数
remainderDecString(String a, String b) → Decimal?
余数
subtractDec(num a, num b) → Decimal?
减 (精确相减,防止精度丢失). subtract (without loosing precision).
subtractDecString(String a, String b) → Decimal?
减
subtractNum(num a, num b) → double
subtract (without loosing precision). 两个数相减(防止精度丢失)
thanOrEqual(num a, num b) → bool
Relational less than or equal operator. 关系小于或等于运算符。判断a是否小于或者等于b
thanOrEqualDecString(String a, String b) → bool
Relational less than or equal operator. 判断a是否小于或者等于b
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited