有没有更好的方式编写此代码:
TextEditingController ectrl = TextEditingController();
TextEditingController passctrl = TextEditingController();
TextEditingController fnamectrl = TextEditingController();
TextEditingController lnamectrl = TextEditingController();
我的意思是来吧!
最佳答案
var ectrl = TextEditingController(),
passctrl = TextEditingController(),
fnamectrl = TextEditingController(),
lnamectrl = TextEditingController();
var ctrls = List.generate(4, (index) => TextEditingController());
关于flutter - 声明同一类的多个对象?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/60806435/