AmountConverter constructor
Creates a converter with the specified decimals and displayPrecision.
Throws AmountConverterException if:
decimalsis negative or exceeds mask8.displayPrecisionis negative.
Implementation
factory AmountConverter({required int decimals, int? displayPrecision = 8}) {
if (decimals.isNegative || decimals > mask8) {
throw AmountConverterException(
'Invalid decimals value: must be between 0 and $mask8.',
);
}
if (displayPrecision != null && displayPrecision.isNegative) {
throw AmountConverterException(
"Invalid displayPrecision value: must be non-negative.");
}
return AmountConverter._(
decimals: decimals, displayPrecision: displayPrecision);
}