How to deal with more than 60 TextFormField in a single screen in flutter?

295 views Asked by At

I am working on an app in which I have to generate PDF based on user input. but there are more than 60 inputs I need to take from user.

So how can i deal with this ?

A common approach I know is to create TextEditingController for each fields and pass all 60+ field's data in function body to generate PDF, but I have never used 60+ controllers in a single screen so I am confused how to deal with it.

please let me know better way to do this.

1

There are 1 answers

4
Lulupointu On BEST ANSWER

If you want to access values within TextFields you have 2 options (afaik):

  1. Create 60 TextEditingController
  2. Create 60 variables (or 1 map, or 1 list), and change these values by taking advantage of the onChange property of the TextField Widget

I would personally go with one map having the field title as a key but this is up to you !