flutter_pattern_formatter
flutter_pattern_formatter copied to clipboard
Invalid radix-10 number (at character 1) when validating input with this formatter
Just testing this out.
Formatting is great, yet when I go to validate and make sure the number is int I get the error message
Invalid radix-10 number (at character 1)
I am calling
if (int.parse(value) >to validate the value, so it looks like parse is not liking the value
Here is my validator
validator: (value) {
if (value.isEmpty) {
return 'Please enter an amount.';
}
if (int.parse(value) >
20) {
return 'Please enter a lower amount. The max you can request is ' +
20)
.toString();
}
return null;
},
please put full code snippet
validator: (value) { if (value.isEmpty) { return 'Please enter an amount.'; } if (int.parse(value) > 20) { return 'Please enter a lower amount. The max you can request is 20 '; }
return null;
}