I'm making an login page with flutter.
In the app, I get the information from user by using TextFormField, so I defined my custom class, 'CustomTextFormFiled', and it gets 3 parameter. The title of the formfield is first one, second one is hintText, and final one is controller.
After setting is finished, i found a error, it says 'The values in a const list literal must be constant. Try removing the keyword 'const' from the list literal.'
I tried changing definition type from final to const, but it not worked. How can i fix it?
This is how controllers are defined,
and this one shows the way how i gave parameters
And this one is my custom text formfield class. enter code here
CodePudding user response:
In your CustomTextFieldController
, instead of dynamic controller
you can declare it TextEditingController controller
.
And also _username, id
declare as follows:
TextEditingController _userName = TextEditingController;
CodePudding user response:
I solved the problem.
I wrote const feature on the code that is not shown in the picture.
`child: ListView(children: const [ SizedBox(height: xlarge_gap), Logo("Register"),
CustomTextFormField(`
const aftert children was the reason of the problem. Thank you.