Currency class

Currency is a large numeric type, with exactly four digit after the decimal point.

Currency type is appropriate for financial calculations that require large numbers of significant integral, up to four fractional digits, and minimize error caused by floating point calculation.

Implemented types

Constructors

Currency()
Create Currency with zero value
Currency.from(num value)
Create Currency from numeric (integer or double) value
Currency.fromBigInt(BigInt value)
Create Currency from BigInt value

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

abs() Currency
Returns the absolute value of this
ceil() Currency
Returns the least Currency having integer components no smaller than this
clamp(Currency lo, Currency hi) Currency
Make sure this is between lo and hi
compareTo(Currency other) int
Compares this object to another object
override
floor() Currency
Returns the greatest Currency having integer value no greater than this
getValue() BigInt
Retuns internal value of this
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
round() Currency
Returns the integer closest to this
toString() String
Convert Currency to string with full 4 decimal places
override

Operators

operator *(Currency other) Currency
Operator *
operator +(Currency other) Currency
Operator +
operator -(Currency other) Currency
Operator -
operator /(Currency other) Currency
Operator /
operator <(Currency other) bool
Operator <
operator <=(Currency other) bool
Operator <=
operator ==(Object other) bool
Operator ==
override
operator >(Currency other) bool
Operator >
operator >=(Currency other) bool
Operator >=

Static Methods

parse(String value) Currency
Returns Currency from value string.
tryParse(String value) Currency?
Returns Currency from value string

Constants

SCALE → const int
Number of decimal point stored in Currency