themisir / form-validator

Simplest form validation for flutter form widgets
https://pub.dev/packages/form_validator
MIT License
78 stars 41 forks source link

Splitting required into notBlank and notNull #10

Closed masseelch closed 3 years ago

masseelch commented 4 years ago

Is your feature request related to a problem? Please describe. When using the required validator on a FormField, that can have non String-type values, like many custom FormFields do (like a DatePicker), the current required validator throws an exception, since it tests on value.length > 0. Some FormFields may even return null.

One can imagine FormFields that allow an empty array as valid value, but not null. In this case the current required validator will not work as expected.

Describe the solution you'd like Replacing required validator with adding notNull and notBlank. Or keeping required but stating it does only work on type String.

Describe alternatives you've considered none

Additional context See my pull request

masseelch commented 4 years ago

I am happy to contribute with a pull request.