I have no of TextEditingController a, TextEditingController b…….z
1)
How to short cut way dispose all TextEditingController
@override
void dispose() {
// _nameCtrl.dispose();
a.dispose();
b.dispose();
.....
....
z.dispose();
super.dispose();
}
- if don’t dispose the TextEditingControll var , will it caused problem ?
thanks
Wing
try to simplify and shorten codee
2
Answers
as per my knowledge:
Well according to a great article on the internet :
Which means that it is a good practice to always dispose off all your controllers as they can cause an issue later on.
And as for your shortcut then why don’t you use a for loop iterating over a list containing all the controller names that you’ve used in your Stateful widget: