Daryl
Daryl

Reputation: 31

Flutter - how do you update the value of textfield without reopening the widget?

I have multiple TextFormField, all have their own value from a file.
My problem:
-when I change the value of the TextFormField, it changes the value of it's own parameter, but it only changes the other TextFormField(based on the same parameter) when I reopen that page.
I tried use setState, but I don't know what parameter should it have.
How should I use setState / what would be a better option? This is how I change the values:

onChanged: (value) => 
       { class.data.minimum = int.parse(value), 
           setState(() {
              class.data.minimum=int.parse(value);
               })
           },

Upvotes: 1

Views: 508

Answers (1)

Md. Yeasin Sheikh
Md. Yeasin Sheikh

Reputation: 63864

by default for text you can use ValueKey, but in your case use globalKey

Upvotes: 1

Related Questions