I am using form field validator, I think it will be the same if using normal TextField, and I have form field like this
TextFormField(
onChanged: (val) => selectedEmail = val,
validator: EmailValidator(errorText: "Email is not valid"),
)
unfortunately, my user sometimes unintentionally will put an empty string at the end of email string like this :
as you can see, I have email validator here, but the email validator will consider the string with empty space like that as an invalid email.
I want to remove or trim the email string first before it is validated by the EmailValidator, how to do that?