'TextFormField enters value backwards [Flutter]

As displayed in the GIF below, the TextFormField i am using is entering the values backwards. I have set the TextDirection property to ltr as well but it did not change anything. Other TextFormFields dont seem to be having this issue. The entered text is being sent back to another screen using Navigator.pop and it is sent in the same backwards manned.

Weird TextFormField

Code for the textFormField causing the issue:

TextFormField(
// validator: (String value) {
// return value.isEmpty ? "task must have a name" : null;
// },
    textDirection: TextDirection.ltr,
    maxLength: 100,
    controller: newcontroller, // Just an ordinary TextController
    onChanged: (value) {
        setState(() {
            newcontroller.text = value;
        });
    },
    decoration: InputDecoration(
        errorText: _validate  // Just a boolean value set to false by default
                   ? 'Value Can\'t Be Empty' : null,
        labelText: "name of task"
    ),
    style: TextStyle(height: 1.2, fontSize: 20, color: Colors.black87)
)


Solution 1:[1]

You don't have to set text in newcontroller.text when onChanged is called. text enter in your TextFormField is assigned by default to newcontroller.

You are getting this error because for this piece of code,

So, try to remove below code

 setState(() {
            newcontroller.text = value;
        });

Solution 2:[2]

replace onChanged with onEditingComplete.

onEditingComplete: (value) {
            newController.text = value;
            FocusScope.of(context).unfocus(); //use this to dismiss the screen keyboard
        }

Solution 3:[3]

Just remove the onChanged function. There is no need for it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ravinder Kumar
Solution 2 Mohammad K. Albattikhi
Solution 3 Khalil