Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to show validation on submit? #2

Open
ssatz opened this issue Feb 23, 2019 · 1 comment
Open

How to show validation on submit? #2

ssatz opened this issue Feb 23, 2019 · 1 comment

Comments

@ssatz
Copy link

ssatz commented Feb 23, 2019

How to show validation on submit?

submit() {
    final validEmail = _emailController.value;
    final validPassword = _passwordController.value;

    print('Email is $validEmail, and password is $validPassword');
  }
@fr4nk-dev
Copy link

Try this, or add more validations for example min lenght or something else

submit() {
    if (email.length == 0) {
      _emailController.sink.addError('This field cannot be empty');
    }

    if (pass.length == 0) {
      _passController.sink.addError('This field cannot be empty');
    }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants