The argument type 'Object?' can't be assigned to the parameter type 'int'

Viewed 86
            RadioListTile(
              value: 1,
              groupValue: selectedRadio,
              title: Text("Doctor" , style: TextStyle(fontSize: 19.0)),
              activeColor: Colors.green,
              onChanged: (val) {
                setSelectedRadio(val);
                //print(selectedRadio);
              },
            ),

on the val variable i am getting this error of The argument type 'Object?' can't be assigned to the parameter type 'int'.

2 Answers

Try changing it to

setSelectedRadio(val as int);

Instead of passing whole Object just pass the id of selectedRadio Object

Related