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

Veröffentlicht am: 11 Januar 2024
auf dem Kanal: 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


Auf dieser Seite können Sie das Online-Video FLUTTER ERROR || Failed assertion: 'initialValue == null || controller == null': is not true. mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer IFASTEK TV 11 Januar 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 275 Mal angesehen und es wurde von 2 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!