converAmount static method
Multiplies two decimal amounts and converts the result to base units.
Implementation
static BigInt converAmount({
required String baseAmount,
required String amount,
required int decimals,
}) {
final BigRational? bPrice = BigRational.tryParseDecimaal(baseAmount);
final BigRational? aPrice = BigRational.tryParseDecimaal(amount);
if (bPrice == null || aPrice == null) {
throw AmountConverterException(
'Invalid amount format: cannot parse the input string.');
}
return toUnit(
amount: (bPrice * aPrice).toDecimal(),
decimals: decimals,
enforceMaxDecimals: false);
}