Decimal class

Implemented types

Constructors

Decimal.fromBigInt(BigInt value)
factory
Decimal.fromInt(int value)
factory
Decimal.fromJson(String value)
factory
Decimal.parse(String value)
factory

Properties

hasFinitePrecision → bool
Inspect if this num has a finite precision.
no setter
hashCode → int
The hash code for this object.
no setteroverride
inverse → Decimal
no setter
isInfinite → bool
no setter
isInteger → bool
no setter
isNaN → bool
no setter
isNegative → bool
no setter
precision → int
The precision of this num.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scale → int
The scale of this num.
no setter
signum → int
The signum function value of this num.
no setter

Methods

abs() → Decimal
Returns the absolute value of this num.
ceil() → Decimal
Returns the least integer value that is no smaller than this num.
ceilToDouble() → double
Returns the least integer value no smaller than this.
clamp(Decimal lowerLimit, Decimal upperLimit) → Decimal
Clamps this to be in the range lowerLimit-upperLimit. The comparison is done using compareTo and therefore takes -0.0 into account.
compareTo(Decimal other) → int
Compares this object to another object.
override
floor() → Decimal
Returns the greatest integer value no greater than this num.
floorToDouble() → double
Returns the greatest integer value no greater than this.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pow(int exponent) → Decimal
Returns this to the power of exponent.
remainder(Decimal other) → Decimal
Return the remainder from dividing this num by other.
round() → Decimal
Returns the integer value closest to this num.
roundToDouble() → double
Returns the integer value closest to this.
toBigInt() → BigInt
Truncates this num to a big integer and returns the result as an BigInt.
toDouble() → double
Return this num as a double.
toInt() → int
Truncates this num to an integer and returns the result as an int.
toJson() → String
Convert this to String by using toString.
toString() → String
Return a String representation of this decimal.
override
toStringAsExponential([int? fractionDigits]) → String
Converts a num to a string in decimal exponential notation with fractionDigits digits after the decimal point.
toStringAsFixed(int fractionDigits) → String
Converts a num to a string representation with fractionDigits digits after the decimal point.
toStringAsPrecision(int precision) → String
Converts a num to a string representation with precision significant digits.
truncate() → Decimal
Returns the integer value obtained by discarding any fractional digits from this num.
truncateToDouble() → double
Returns the integer obtained by discarding any fractional digits from this.

Operators

operator %(Decimal other) → Decimal
operator *(Decimal other) → Decimal
operator +(Decimal other) → Decimal
operator -(Decimal other) → Decimal
operator /(Decimal other) → Decimal
operator <(Decimal other) → bool
Relational less than operator.
operator <=(Decimal other) → bool
Relational less than or equal operator.
operator ==(Object other) → bool
The equality operator.
override
operator >(Decimal other) → bool
Relational greater than operator.
operator >=(Decimal other) → bool
Relational greater than or equal operator.
operator unary-() → Decimal
operator ~/(Decimal other) → Decimal
Truncating division operator.

Static Properties

one ↔ Decimal
getter/setter pair
ten ↔ Decimal
getter/setter pair
zero ↔ Decimal
getter/setter pair

Static Methods

tryParse(String value) → Decimal?