AmountConverter class
Handles conversions between human-readable amounts and base units.
Constructors
- AmountConverter({required int decimals, int? displayPrecision = 8})
-
Creates a converter with the specified
decimalsanddisplayPrecision.factory
Properties
- decimals → int
-
Number of decimal places used by the base unit (e.g., 8 for BTC).
final
- displayPrecision → int?
-
Maximum number of decimals to show when formatting display values.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toAmount(
BigInt unit) → String - Converts a base unit value to a human-readable decimal string.
-
toString(
) → String -
A string representation of this object.
inherited
-
toUnit(
String amount, {bool enforceMaxDecimals = true}) → BigInt - Converts a human-readable amount string to its base unit representation.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- ada → const AmountConverter
- btc → const AmountConverter
- eth → const AmountConverter
- kusama → const AmountConverter
- polkadot → const AmountConverter
- sol → const AmountConverter
- tron → const AmountConverter
- xrp → const AmountConverter