Skip to content

Add a way to clear the _errorText.value in FormFieldState without having to call .reset() #178805

@limonadev

Description

@limonadev

Use case

For a custom Form, if we have a field showing an error after calling validate(), it could be required that modifying a different field changes the state of the Form, including the first invalid one.
If we use the auto validate mode, the field will be still invalid, but we may not want to show that to the user until they make a different action (like pressing a button).

This can be somewhat accomplished by calling FormState.reset() and then didChange(previousValue) but it seems more like a workaround than the right way of just clearing the error.

Proposal

To add a new method FormState.clearError() which would just set the _errorText.value to null, similar to the reset() method without modifying the field value.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.team-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions