add named constructor that should have been done ages ago

This commit is contained in:
julian 2023-12-27 09:07:40 -06:00
parent 8cc72f3448
commit cb46c2fa3a

View file

@ -26,6 +26,10 @@ class Amount {
fractionDigits: 0, fractionDigits: 0,
); );
Amount.zeroWith({required this.fractionDigits})
: assert(fractionDigits >= 0),
_value = BigInt.zero;
/// truncate decimal value to [fractionDigits] places /// truncate decimal value to [fractionDigits] places
Amount.fromDecimal(Decimal amount, {required this.fractionDigits}) Amount.fromDecimal(Decimal amount, {required this.fractionDigits})
: assert(fractionDigits >= 0), : assert(fractionDigits >= 0),