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 add a prefix? #51

Closed
ariefsn opened this issue Dec 16, 2022 · 3 comments
Closed

How to add a prefix? #51

ariefsn opened this issue Dec 16, 2022 · 3 comments

Comments

@ariefsn
Copy link

ariefsn commented Dec 16, 2022

Is your feature request related to a problem? Please describe.
How to add a prefix to the message? eg. Field-A is required, Field-B is required, etc.

Describe the solution you'd like
Perhaps, all of the rule can have field as first parameter. So that field can be add to the message.

  ValidationBuilder required() => add((String? field, value) {
        return (value ?? "").isEmpty ? '${(field ?? "Field")} is required' : null;
      });

   ValidationBuilder(prefix: "Field-A").required()
   ValidationBuilder(prefix: "Field-B").required()
@themisir
Copy link
Owner

Hey @ariefsn, the feature you've asking for is not supported or is not planned to be supported anytime soon. I am sorry for that but at this point I can't change the core design of the system.

@ariefsn
Copy link
Author

ariefsn commented Dec 16, 2022

oh ok.
no probs, thanks for the answer @themisir
we can close this.
thanks for the package 👍🏻

@ariefsn ariefsn closed this as completed Dec 16, 2022
@themisir
Copy link
Owner

Appreciate it 😇 To put more context the reason why it's not possible at the moment is, the package now supports multiple language translations in which adding a new feature would mean having to support it in all of them is not feasible - the translations have been provided by various contributors.

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