ArbitAmount class

Utility class to easily convert amounts of Arbit into different units of quantities.

Inheritance

Constructors

ArbitAmount({required num quantity, required dynamic unit})
ArbitAmount.fromUnitAndValue(ArbitUnit unit, dynamic amount)
Constructs an amount of Arbit by a unit and its amount. amount can either be a base10 string, an int, or any numerical value.
factory
ArbitAmount.inNanoarbit({required num quantity})
ArbitAmount.zero()

Properties

getInArbit num
no setter
getInNanoarbit num
no setter
hashCode int
The hash code for this object.
no setteroverride
quantity num
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
unit → dynamic
finalinherited

Methods

getValueInUnit(ArbitUnit unit) num
Gets the value of this amount in the specified unit. WARNING: Due to rounding errors, the return value of this function is not reliable, especially for larger amounts or smaller units. While it can be used to display the amount of arbit in a human-readable format, it should not be used for anything else.
getValueInUnitBI(ArbitUnit unit) num
Gets the value of this amount in the specified unit as a whole number. WARNING: For all units except, this method will discard the remainder occurring in the division, making it unsuitable for calculations or storage. You should store and process amounts of poly by using a BigInt storing the amount in nanoarbit.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() String
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(dynamic other) bool
The equality operator.
override