有没有更好的方式编写此代码:
TextEditingController ectrl = TextEditingController();
TextEditingController passctrl = TextEditingController();
TextEditingController fnamectrl = TextEditingController();
TextEditingController lnamectrl = TextEditingController();
我的意思是快来吧!
答案 0 :(得分:2)
var ectrl = TextEditingController(),
passctrl = TextEditingController(),
fnamectrl = TextEditingController(),
lnamectrl = TextEditingController();
var ctrls = List.generate(4, (index) => TextEditingController());