Using a key

The Form widget is used with the companion of a key of the FormState type that contains helpers to manage all of the children of its FormField instances:

final _key = GlobalKey<FormFieldState<String>>();
...
Form(
key: _key,
child: Column(
children: <Widget>[
TextFormField(),
TextFormField(),
],
),
);

Then, we can use the key to retrieve the Form associated state and call its validation with _key.currentState.validate(). Now, let's have a look at the second option.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.118.250