flutter_pattern_formatter icon indicating copy to clipboard operation
flutter_pattern_formatter copied to clipboard

Invalid radix-10 number (at character 1) when validating input with this formatter

Open giorgio79 opened this issue 4 years ago • 2 comments

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;
                                },

giorgio79 avatar Apr 05 '21 17:04 giorgio79

please put full code snippet

elvissalabarria avatar Jul 20 '21 03:07 elvissalabarria

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;

}

elvissalabarria avatar Jul 20 '21 03:07 elvissalabarria