Recall & Review
beginner
What is a
TextFormField in Flutter?A
TextFormField is a widget that allows users to enter and edit text in a form. It integrates with form validation and saving mechanisms.Click to reveal answer
beginner
How do you validate user input in a
TextFormField?You provide a
validator function that returns an error message string if the input is invalid, or null if it is valid.Click to reveal answer
beginner
What property do you use to save the input value from a
TextFormField?Use the
onSaved property, which takes a function to save the input value when the form is saved.Click to reveal answer
intermediate
How can you control the text inside a
TextFormField programmatically?By using a
TextEditingController assigned to the controller property of the TextFormField.Click to reveal answer
intermediate
Why should you wrap
TextFormField widgets inside a Form widget?Wrapping inside a
Form allows collective validation and saving of multiple fields together using a GlobalKey<FormState>.Click to reveal answer
Which property of
TextFormField is used to check if the input is valid?✗ Incorrect
The
validator property is a function that checks the input and returns an error message if invalid.What does the
onSaved callback do in a TextFormField?✗ Incorrect
onSaved is called when the form is saved to store the input value.Which widget should wrap
TextFormField widgets to manage form state?✗ Incorrect
The
Form widget manages the state of multiple TextFormField widgets.How do you programmatically change the text inside a
TextFormField?✗ Incorrect
A
TextEditingController lets you read and change the text programmatically.What happens if the
validator function returns a non-null string?✗ Incorrect
Returning a string from
validator means the input is invalid and displays that string as an error.Explain how to use
TextFormField inside a form to collect and validate user input.Think about how you group fields and check their values before saving.
You got /5 concepts.
Describe how
TextEditingController works with TextFormField and why it might be useful.Consider when you want to change or read the text from code, not just user typing.
You got /4 concepts.