FdcDecimal.parse constructor
FdcDecimal.parse(})
Parses decimal text.
When scale is omitted, the scale is inferred from the parsed text. Pass
scale to round and normalize the value to a fixed number of decimals.
Implementation
factory FdcDecimal.parse(
String text, {
int? scale,
String decimalSeparator = '.',
String? thousandSeparator,
bool negative = true,
bool allowCommaDecimalFallback = true,
}) {
final decimal = tryParse(
text,
scale: scale,
decimalSeparator: decimalSeparator,
thousandSeparator: thousandSeparator,
negative: negative,
allowCommaDecimalFallback: allowCommaDecimalFallback,
);
if (decimal == null) {
throw FormatException('Invalid decimal value.', text);
}
return decimal;
}