RadioListTile(
value: 1,
groupValue: selectedRadio,
title: Text("Doctor" , style: TextStyle(fontSize: 19.0)),
activeColor: Colors.green,
onChanged: (val) {
setSelectedRadio(val);
//print(selectedRadio);
},
),
在val变量上,我得到参数类型"对象"的错误?'不能赋值给形参类型'int'。
不传递整个对象,只传递selecteradio Object的id
试试改成
setSelectedRadio(val as int);