email-validator.dart icon indicating copy to clipboard operation
email-validator.dart copied to clipboard

Return reason for invalidity

Open woolfred opened this issue 11 months ago • 4 comments

Hey 👋 Thanks for your library!

I wanted to check if you would consider including a way, to provide the reason the validation fails? Maybe by returning enum values or something.

I guess many use the library to validate an email input, but then can only add an error message like "Please enter a valid email address", while most users don't really get why the entered address isn't working. Especially if they added an accidental whitespace at the end.

We are currently adding some additional validations for certain cases like whitespaces, but this also means we start to duplicate logic from your library, which doesn't feel right.

Looking forward to hear your thoughts on this. Cheers

woolfred avatar Jul 18 '23 10:07 woolfred