Currency class

The Currency is a number type with four decimal places. The Currency is appropriate for financial calculations that require large numbers without round-off errors.

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
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