Closed aaronkelton closed 2 years ago
Are you using the latest version? This package has impemented null-safety for quite some time.
I’m not sure if others are experiencing the same issue or not. I will look into the stackoverflow post to see if this affects the code.. @aaronkelton
Version 2.0.1
I wish I had a better understanding of Dart and null-safety to understand this error message. I can get the error to disappear by changing the print line to use double question marks instead of bang:
print(EmailValidator.validate(value ?? ''));
I don't know if:
value!
incorrectly per Dart best practices, orTextFormField
widget.Maybe banging a variable more than once is the issue. 🤷♂️ Thank you for considering my issue! ❤️
Before adding null check
When using the
TextFormField
'svalidator
parameter, passing the value toEmailValidator.validate()
warns that I need to Add a null check (!). Screenshot showing the warning with suggested fix.After adding null check (plus print statement)
However, if I add the null check bang, and try to print the result of
EmailValidator.validate(value!)
, I get a different warning:Question
Is this warning something that should be fixed in this
email-validator
package? The Stack Overflow posts I've read for this warning from other packages indicated that a fix was necessary in the package's code. E.g. https://stackoverflow.com/questions/67389956/why-im-getting-this-error-warning-operand-of-null-aware-operation-has-type