When the user attempts to submit the form, check if the form is valid.
If it is, display a success message.
If it isn’t (the text field has no content) display the error message.

How does this work?

To validate the form, use the _formKey created in
step 1. You can use the _formKey.currentState()
method to access the FormState,
which is automatically created by Flutter when building a Form.

Interactive example

Drag a UI element

Create and style a text field