最佳答案
我试图为文本字段设置一个初始值。但是我不能在文本表单字段中设置初始值。我得到这个错误 'initialValue == null || controller == null': is not true
。
密码:
Widget buildFirstName(BuildContext context) {
valueBuilder = valueBuild();
return TextFormField(
controller: firstNameController,
initialValue: valueBuilder,
decoration: InputDecoration(
hintText: "Enter Name",
fillColor: Colors.white,
hintStyle: TextStyle(
color: Color.fromRGBO(0, 0, 0, 1.0),
fontFamily: "SFProText-Regular"),
),
validator: validatingName,
);
}