FLUTTER ERROR || Failed assertion: 'initialValue == null || controller == null': is not true.

Publié le: 11 janvier 2024
sur la chaîne: IFASTEK TV
275
2

In flutter, when you are trying to use both initial value and controller in your textform field

SOLUTION BY CopsOnRoad FROM STACK OVER FLOW
https://stackoverflow.com/questions/5...
You can't use both initialValue and controller at the same time. So, it's better to use controller as you can set default text in its constructor.

Here is an example.

// Create the controller.
final controller = TextEditingController(text: "Your initial value");

Widget build(BuildContext context) {
return TextFormField(
controller: controller, // Assign it here.
// ...
);
}
To get the value entered by the user, use:

controller.text


Sur cette page du site, vous pouvez voir la vidéo en ligne FLUTTER ERROR || Failed assertion: 'initialValue == null || controller == null': is not true. durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur IFASTEK TV 11 janvier 2024, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 275 fois et il a aimé 2 téléspectateurs. Bon visionnage!