Flutter - 'initialValue == null || controller == null': is not true. error

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