tryParse static method
Parses user text using optional localized separators and stores it at the
requested scale.
Implementation
static FdcDecimal? tryParse(
String text, {
int? scale,
String decimalSeparator = '.',
String? thousandSeparator,
bool negative = true,
bool allowCommaDecimalFallback = true,
}) {
final normalized = FdcDecimalMath.normalizeTextForParsing(
text,
decimalSeparator: decimalSeparator,
thousandSeparator: thousandSeparator,
negative: negative,
allowCommaDecimalFallback: allowCommaDecimalFallback,
);
if (normalized == null || normalized.isEmpty) {
return null;
}
final effectiveScale = scale ?? _fractionScale(normalized);
return tryParseNormalized(normalized, scale: effectiveScale);
}