title: The named parameter 'email is required, but there's no corresponding argument
body: <p>I've a problem with this kind of bug and I hope someone can please tell me how to fix it.</p>
  <p>The code:</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:login_form/model/login_model.dart';
  
  class LoginPage extends StatefulWidget {
    const LoginPage({Key? key}) : super(key: key);
  
    @override
    _LoginPageState createState() =&gt; _LoginPageState();
  }
  
  class _LoginPageState extends State&lt;LoginPage&gt; {
    final scaffoldKey = GlobalKey&lt;ScaffoldState&gt;();
    GlobalKey&lt;FormState&gt; globalFormKey = new GlobalKey&lt;FormState&gt;();
    bool hidePassword = true;
    LoginRequestModel requestModel;
  
    @override
    void initState() {
      super.initState();
      requestModel = new LoginRequestModel();
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
          key: scaffoldKey,
          backgroundColor: Theme.of(context).accentColor,
          body: SingleChildScrollView(
            child: Column(
              children: &lt;Widget&gt;[
                Stack(
                  children: &lt;Widget&gt;[
                    Container(
                      width: double.infinity,
                      padding: EdgeInsets.symmetric(vertical: 30, horizontal: 20),
                      margin: EdgeInsets.symmetric(vertical: 85, horizontal: 20),
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(20),
                        color: Theme.of(context).primaryColor,
                        boxShadow: [
                          BoxShadow(
                              color: Theme.of(context).hintColor.withOpacity(0.2),
                              offset: Offset(0, 10),
                              blurRadius: 20)
                        ],
                      ),
                      child: Form(
                        key: globalFormKey,
                        child: Column(
                          children: &lt;Widget&gt;[
                            SizedBox(
                              height: 25,
                            ),
                            Text(
                              &quot;Login&quot;,
                              style: Theme.of(context).textTheme.headline2,
                            ),
                            SizedBox(
                              height: 20,
                            ),
                            new TextFormField(
                              keyboardType: TextInputType.emailAddress,
                              onSaved: (input) =&gt; requestModel.email = input,
                              validator: (input) =&gt;
                                  !(input?.contains(&quot;@&quot;) ?? false)
                                      ? &quot;Email id Should be valid&quot;
                                      : null,
                              decoration: new InputDecoration(
                                hintText: &quot;Email Address&quot;,
                                enabledBorder: UnderlineInputBorder(
                                    borderSide: BorderSide(
                                  color: Theme.of(context)
                                      .accentColor
                                      .withOpacity(0.2),
                                )),
                                focusedBorder: UnderlineInputBorder(
                                    borderSide: BorderSide(
                                        color: Theme.of(context).accentColor)),
                                prefixIcon: Icon(Icons.email,
                                    color: Theme.of(context).accentColor),
                              ),
                            ),
                            SizedBox(
                              height: 20,
                            ),
                            new TextFormField(
                              keyboardType: TextInputType.text,
                              onSaved: (input) =&gt; requestModel.password = input,
                              validator: (input) =&gt; (input != null &amp;&amp;
                                      input.length &lt; 3)
                                  ? &quot;Password should be more than &lt; 3 characters&quot;
                                  : null,
                              obscureText: hidePassword,
                              decoration: new InputDecoration(
                                hintText: &quot;Password&quot;,
                                enabledBorder: UnderlineInputBorder(
                                    borderSide: BorderSide(
                                  color: Theme.of(context)
                                      .accentColor
                                      .withOpacity(0.2),
                                )),
                                focusedBorder: UnderlineInputBorder(
                                    borderSide: BorderSide(
                                        color: Theme.of(context).accentColor)),
                                prefixIcon: Icon(Icons.lock,
                                    color: Theme.of(context).accentColor),
                                suffixIcon: IconButton(
                                  onPressed: () {
                                    setState(() {
                                      hidePassword = !hidePassword;
                                    });
                                  },
                                  icon: Icon(hidePassword
                                      ? Icons.visibility_off
                                      : Icons.visibility),
                                ),
                              ),
                            ),
                            SizedBox(
                              height: 30,
                            ),
                            TextButton(
                                child: Text(
                                  &quot;Login&quot;,
                                  style: TextStyle(color: Colors.white),
                                ),
                                onPressed: () {
                                  if (validateAndSave()) {
                                    print(requestModel.toJson());
                                  }
                                },
                                style: TextButton.styleFrom(
                                    padding: EdgeInsets.symmetric(
                                      vertical: 12,
                                      horizontal: 80,
                                    ),
                                    backgroundColor:
                                        Theme.of(context).accentColor,
                                    shape: StadiumBorder())),
                          ],
                        ),
                      ),
                    ),
                  ],
                )
              ],
            ),
          ));
    }
  
    bool validateAndSave() {
      final form = globalFormKey.currentState;
      if (form!.validate()) {
        form.save();
        return true;
      }
      return false;
    }
  }
  </code></pre>
  <p>
  this is my Loginmodel.dart code
  <pre><code>class LoginResponseModel {
    final String status;
    final String message;
    final String kid;
    final String uid;
    final String email;
    final String password;
  
    LoginResponseModel({
      required this.status, 
      required this.message, 
      required this.kid, 
      required this.uid, 
      required this.email,
      required this.password});
  
  
    factory LoginResponseModel.fromJson(Map&lt;String, dynamic&gt; json) {
      return LoginResponseModel(
          status: json[&quot;status&quot;] as String? ?? &quot;&quot;,
          message: json[&quot;message&quot;] as String? ?? &quot;&quot;,
          kid: json[&quot;kid&quot;] as String? ?? &quot;&quot;,
          uid: json[&quot;uid&quot;] as String? ?? &quot;&quot;,
          email: json[&quot;email&quot;] as String? ?? &quot;&quot;,
          password: json[&quot;password&quot;] as String? ?? &quot;&quot;,
        );
    }
  }
  
  class LoginRequestModel {
    String email;
    String password;
  
    LoginRequestModel({
      required this.email,
      required this.password,
      });
  
    Map&lt;String, dynamic&gt; toJson() {
      Map&lt;String, dynamic&gt; map = {
        'email': email.trim(),
        'password': password.trim(),
      };
      return map;
    }
  }
  </code></pre>
  <p>The error:</p>
  <blockquote>
  <p>The Error On LoginRequestModel requestModel; says &quot; Non Nullable Instance field 'requestModel' must be initialized.<p>
  Then Error message on requestModel = new LoginRequestModel() says The Named Parameter 'email is required, but there's no corresponding argument.<p>
  And Last On OnSaved = input says &quot;A value of type 'String?' can't be assigned to a variable of type 'string'.&quot;</p>
  </blockquote>
  <p>I really appreciate the answer you gave</p>