validation property
This triggers the color of the field and adds an error text right under the InputField for the user if wanted. This validation is triggered also during initialization by default. You can change that with the initialValidation attribute.
If the validation returns a filled String, the contend will be added as error. If the validation returns an empty String, just the color of the field will be triggered. If the validation returns null, no error response appear.
You can use it like this: validation: (String text) { if (text.isEmpty) return 'Must not be empty!'; },
Implementation
final String? Function(String)? validation;