extended_masked_text
extended_masked_text copied to clipboard
FormatException: Invalid number (at character 1)
With the following code I get this error:
MoneyMaskedTextController? moneyController = MoneyMaskedTextController(
decimalSeparator: '.',
thousandSeparator: ',');
moneyController!.updateValue(45.67);
Can you provide the stack-trace or a minimal sample project? I was unable to reproduce this error with the provided code.
In debugging your code I realized you have a try/catch in the flow, and I had break on All Exceptions enabled, so this was being reported to me as a crash. I will close this as designed, but maybe there's a better way to detect the issue.
The exact line of code is:
(money_masked_text_controller.dart line 142)
var numberOfLeadingZeros = text.length - int.parse(text).toString().length;
If text is "" the int.parse will error. I think this should be changed to int?.parse