Retrieving user input

Given how Flutter uses immutable widgets with a separate state,
you might be wondering how user input fits into the picture.
In UIKit, you usually query the widgets for their current values
when it’s time to submit the user input, or action on it.
How does that work in Flutter?

In practice forms are handled, like everything in Flutter,
by specialized widgets. If you have a TextField or a
TextFormField, you can supply a TextEditingController
to retrieve user input:

You can find more information and the full code listing in
Retrieve the value of a text field,
from the Flutter cookbook.

Placeholder in a text field

In Flutter, you can easily show a “hint” or a placeholder text
for your field by adding an InputDecoration object
to the decoration constructor parameter for the Text widget:

Showing validation errors