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

Support conditional validators #62

Closed
petrnymsa opened this issue May 13, 2024 · 0 comments · Fixed by #64
Closed

Support conditional validators #62

petrnymsa opened this issue May 13, 2024 · 0 comments · Fixed by #64
Labels
enhancement New feature or request

Comments

@petrnymsa
Copy link
Member

Right now, validators are build once during initialize(). Often you can require input to be notNull based on some condition, example based on different input's value.

To do this, in current version you have to implement custom validation with satisfy() or custom e.g

v..satisfy((value) {
// if other input is 1, do not require validation
  if(otherInput.value == 1) return true;

	return value != null;
}

Include argument

Each validator could accept "include" argument which will determine if particular validation part should be considered through validation process.

(v..notNull(include: () => otherInput.value != 1)).build()
@petrnymsa petrnymsa added the enhancement New feature or request label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant