NumUtil class Null safety

数字工具类

another Fairy

# https://github.com/dart-lang/convert
decimal: ">=1.0.0 <3.0.0"

Constructors

NumUtil()

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited

Static Methods

add(num? a, num? b) double
加 (精确相加,防止精度丢失). [...]
addDec(num? a, num? b) Decimal
加 (精确相加,防止精度丢失). [...]
addDecStr(String? a, String? b) Decimal
divide(num? a, num b) double
除 (精确相除,防止精度丢失). [...]
divideDec(num? a, num b) Decimal
除 (精确相除,防止精度丢失). [...]
divideDecStr(String? a, String b) Decimal
format(double? value, {int fractionDigits = 0}) num
将数字按格式输出 [...]
formatStr(double? value, {int fractionDigits = 0}) String
将数字按格式输出 [...]
greaterOrEqual(num a, num b) bool
a是否大于或者等于b
greaterOrEqualDecStr(String a, String b) bool
a是否大于或者等于b
greaterThan(num a, num b) bool
a是否大于b
greaterThanDecStr(String a, String b) bool
a是否大于b
isZero(num? value) bool
是否为0
lessThan(num a, num b) bool
a是否小于b
lessThanDecStr(String a, String b) bool
a是否小于b
lessThanOrEqual(num a, num b) bool
a是否小于或者等于b
lessThanOrEqualDecStr(String a, String b) bool
a是否小于或者等于b
multiply(num? a, num? b) double
乘 (精确相乘,防止精度丢失). [...]
multiplyDec(num? a, num? b) Decimal
乘 (精确相乘,防止精度丢失). [...]
multiplyDecStr(String? a, String? b) Decimal
parse(String? valueStr, {int fractionDigits = 0}) num
将字符串转换为数字,转换出错抛出异常 [...]
parseDouble(String? valueStr, {double? defValue}) double
获取int值 [...]
parseInt(String? valueStr, {int? defValue}) int
获取int值 [...]
remainder(num a, num b) Decimal
余数
remainderDecStr(String a, String b) Decimal
余数
subtract(num? a, num? b) double
减 (精确相减,防止精度丢失). [...]
subtractDec(num? a, num? b) Decimal
减 (精确相减,防止精度丢失). [...]
subtractDecStr(String? a, String? b) Decimal
tryParse(String? numStr, {int fractionDigits = 0}) num
将字符串转换为数字,转换出错不抛出异常 [...]