fluttertextformfieldflutter-textformfield

How do I make the helper text in textform field appear conditionally


How do I make the helper text in textformfield appear conditionally I don't want helper text if there is no error and need when the error message needs to be displayed

helperText: Validator.validate(value) != null ? '' : null;

Can it be conditionally delivered or is there any solution to do so?


Solution

  • If you want to conditionally give the helperText property a value, that'd be:

    helperText: Validator.validate(value) != null ? value: '';