title: Accessing flutter Form key from AppBar actions in flutter?
body: <p>I want to access Form key to validate if form data in valid from AppBar action in flutter app , and then manipulate the data.</p>
  <p><strong>This is my code</strong></p>
  <p>Flutter build method:</p>
  <pre><code> @override
    Widget build(BuildContext context) {
      return Form(
        key: _formKey,
        child: Padding(
          padding: const EdgeInsets.all(10.0),
          child: SingleChildScrollView(
            child: Column(
              children: [
                Row(
                  children: [
                    _buildDoctor(),
                    const SizedBox(width: 10),
                    _buildDate(),
                  ],
                ),
                const SizedBox(height: 10.0),
                _buildRemark(),
                const SizedBox(height: 10.0),
                _buildFormSet(),
              ],
            ),
          ),
        ),
      );
    }
  
  </code></pre>
  <p>And this is my State class</p>
  <pre><code>class _SalesPage extends State&lt;SalesPage&gt; {
  final GlobalKey&lt;FormState&gt; _formKey = GlobalKey&lt;FormState&gt;();
  ...
  }
  
  </code></pre>
  <p>And this is my AppBar</p>
  <pre><code>AppBar(
          title: const Text('Add Sales'),
          actions: [
            IconButton(
              icon: const Icon(Icons.save),
              onPressed: () {
                final form = Form.of(context);
                if (form!.validate()) {
                  
                }
              },
            ),
          ],
        ),
  
  </code></pre>