title: An email address must be provided / The email address is badly formatted
body: <p>I'm getting &quot;flutter: [firebase_auth/missing-email] An email address must be provided.&quot; when I register. Used dummy@gmail.com</p>
  <p>And &quot;flutter: [firebase_auth/invalid-email] The email address is badly formatted.&quot; when I sign in with a registered account. (previously had an email that worked and made an account via firebase website also, get the same msg for both)</p>
  <p>I saw trim() as a possible solution but don't know how to implement it. I made sure there were no spaces tho... can you please tell me what is wrong or missing from my code?</p>
  <p>Here is some code from my register page (looks pretty much the same on my sign in page), let me know if you need to see more</p>
  <pre><code>  String email = '';
    String password = '';
    String error = '';
  </code></pre>
  <pre><code>TextFormField(
                          textInputAction: TextInputAction.next,
                          style: TextStyle(color: Colors.white),
                          decoration: textInputDecoration.copyWith(
                            hintText: ('Enter Email'),
                            hintStyle: TextStyle(color: Colors.white),
                            enabledBorder: UnderlineInputBorder(
                              borderSide: BorderSide(color: Colors.white),
                            ),
                          ),
                          keyboardType: TextInputType.emailAddress,
                          validator: (value) {
                            if (value!.isEmpty) {
                              return 'Email is required';
                            }
                            if (value.isNotEmpty) {
                              final RegExp regex = RegExp(
                                  r'^(([^&lt;&gt;()[\]\\.,;:\s@\&quot;]+(\.[^&lt;&gt;()[\]\\.,;:\s@\&quot;]+)*)|(\&quot;.+\&quot;))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$');
                              if (!regex.hasMatch(value))
                                return 'Enter a valid email';
                              else
                                return null;
                            } else {
                              return 'Enter a valid email';
                            }
                          },
                        ),
  </code></pre>
  <pre><code>ElevatedButton(
                            child: Text(
                              'Register',
                              style: TextStyle(color: Colors.white),
                            ),
                            style: ElevatedButton.styleFrom(
                                primary: Color(0xFF162242)),
                            onPressed: () async {
                              if (_formKey.currentState!.validate()) {
                                setState(() =&gt; loading = true);
                                dynamic result =
                                    await _auth.registerWithEmailAndPassword(
                                        email, password);
  
                                if (result == null) {
                                  setState(() {
                                    error = 'please enter valid email';
                                    loading = false;
                                  });
                                }
                              }
                            }),
  </code></pre>