title: How can I put an initial value on my TextFormField with a Controller?
body: <p>How can I display my &quot;teamName&quot; value in the AlertDialog form while keeping the controller and not use &quot;InitialValue&quot; from my TextFormField? This is when I update the team name, I want the form to show it's name when the AlertDialog shows up. I am new to flutter, if you need anything else from my code just tell me.</p>
  <pre><code>AlertDialog alert = AlertDialog(
                                        title: const Text(
                                            &quot;Modifier le nom de votre équipe&quot;),
                                        content: Form(
                                          key: _thekey,
                                          child: TextFormField(
                                            controller: textController,
                                            validator: (val) =&gt; val?.length == 0
                                                ? &quot;Indiquez un nom d'équipe s'il vous plait&quot;
                                                : null,
                                            onSaved: (val) =&gt;
                                            textController.text = val!,
                                          ),
                                        ),
                                        actions: [
                                          ElevatedButton(
                                              onPressed: (() {
                                                teamName = textController.text;
                                                print(&quot;le nom de la teamsss est : $teamName&quot;);
                                                setState(() {
                                                  print(
                                                      &quot;le nom de l'équipe est: $teamName&quot;);
                                                  updateTeam(
                                                      team.idTeam,
                                                      textController,
                                                      idCoach,
                                                      context);
  
                                                });
                                              }),
                                              child: const Text(&quot;Modifier&quot;))
                                        ],
                                      );
                                      showDialog(
                                          barrierDismissible: true,
                                          context: context,
                                          builder: (BuildContext ctx) {
                                            return alert;
                                          });
  
  
  </code></pre>
  <p>The alertDialog is supposed to get the teamName from a ListView. The prints with &quot;$teamName&quot; shows the right name, the update method works but I just want the field to have the initial name on it.</p>
  <p>This is the update method if you need it as well</p>
  <pre><code>updateTeam(idTeam, textController, idCoach, context) async {
    final statAccess = DatabaseModel();
    SharedPreferences sp = await _pref;
    idCoach = sp.getInt(&quot;id&quot;);
    String nameControl = textController.text;
    print(&quot;le nameControl est: $nameControl&quot;);
    if (nameControl.isEmpty) {
      alertDialog(&quot;le nom est vide&quot;, false);
    } else {
      Teams team =
          Teams(idTeam: idTeam, nameTeam: nameControl, xidCoach: idCoach);
      await statAccess.updateTeam(team).then((value) {
        print(value);
        if (value == 1) {
          alertDialog(&quot;Mise à jour réussie&quot;, true);
          Navigator.of(context, rootNavigator: true).pop();
        } else {
          alertDialog(&quot;la mise à jour à foiré&quot;, false);
        }
      }).catchError((error) {
        print(error);
        alertDialog(&quot;CA A VRAIMENT FOIRER&quot;, false);
      });
    }
  }
  </code></pre>