CoinUnit class

Objects of this class represent a coin denomination with a given number of decimals. Use coin for whole coins with 6 decimal places and sats for the smallest unit with no decimal places.

Constructors

CoinUnit(int decimals)
Creates a unit with a given number of decimals.

Properties

decimals → int
The number of decimal places for this unit
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
satsPerUnit → BigInt
The number of satoshis per unit
final

Methods

fromSats(BigInt sats) → String
Obtains the string representation of the satoshis (sats) converted into this unit.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toSats(String amount) → BigInt
Obtains the number of satoshis from a string representation of this unit.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

coin → CoinUnit
Represents a whole coin with 8 decimal places
final
sats → CoinUnit
Represents a satoshi
final