title: Unhandled Exception: NoSuchMethodError: The method 'validate' was called on null
body: <p>[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The method 'validate' was called on null.
  E/flutter ( 6538): Receiver: null
  E/flutter ( 6538): Tried calling: validate()
  E/flutter ( 6538): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
  E/flutter ( 6538): #1      _RegisterState.build. (package:firebasestarter/screens/authenticate/Register.dart:85:47)</p>
  <pre><code>import 'package:firebasestarter/screens/authenticate/sign_in.dart';
      import 'package:firebasestarter/services/auth.dart';
  import 'package:flutter/material.dart';
  
  class Register extends StatefulWidget {
    final Function toggleView;
  
    Register({this.toggleView});
  
    @override
    _RegisterState createState() =&gt; _RegisterState();
  }
  
  class _RegisterState extends State&lt;Register&gt; {
    final AuthService _auth = AuthService();
    final _formKey = GlobalKey&lt;FormState&gt;();
   // final formKey = new GlobalKey();
    //text field state
    String email = '';
    String pass = '';
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        backgroundColor: Colors.brown[100],
        appBar: AppBar(
          backgroundColor: Colors.brown[400],
          elevation: 1,
          title: Text(&quot;Sign up to Brew Crew&quot;),
          actions: &lt;Widget&gt;[
            FlatButton.icon(
              icon: Icon(Icons.person),
              label: Text(&quot;Sign-In&quot;),
              onPressed: () {
                widget.toggleView();
              },
            )
          ],
        ),
        body: Container(
            padding: EdgeInsets.symmetric(vertical: 20, horizontal: 50),
            child: Form(
              child: Column(
                key: _formKey,
                children: &lt;Widget&gt;[
                  SizedBox(
                    height: 20,
                  ),
                  TextFormField(
                    validator: (value) {
                      if (value.isEmpty) {
                        return 'Please enter some text';
                      }
                      return null;
                    },
                    onChanged: (val) {
                      setState(() =&gt; pass = val);
                    },
                  ),
                  SizedBox(
                    height: 20,
                  ),
                  TextFormField(
                    validator: (value) {
                      if (value.length&lt;6) {
                        return 'longer pass pls';
                      }
                      return null;
                    },
                    obscureText: true,
                    onChanged: (val) {
                      setState(() =&gt; email = val);
                    },
                  ),
                  SizedBox(
                    height: 20,
                  ),
                  RaisedButton(
                    color: Colors.pink[400],
                    child: Text(
                      &quot;Sign up&quot;,
                      style: TextStyle(color: Colors.white),
                    ),
                    onPressed: () async {
                      if (_formKey.currentState.validate()) {
                        // If the form is valid, display a Snackbar.
                        Scaffold.of(context)
                            .showSnackBar(SnackBar(content: Text('Processing Data')));
                      }
                    },
                  )
                ],
              ),
            )
           
            ),
      );
    }
  }
  </code></pre>