Home > Software design >  The argument type 'Object?' can't be assigned to the parameter type 'int'
The argument type 'Object?' can't be assigned to the parameter type 'int'

Time:07-14

            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'.

CodePudding user response:

Try changing it to

setSelectedRadio(val as int);

CodePudding user response:

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

  • Related