I am trying to make multiple choice questions using RadioListTile.
RadioListTile(
value: 1,
groupValue: 1,
onChanged: (val) {
print("Value");
print(val.runtimeType);
setSelectedRadio(val);
},
title: Text(snapshot.data!.data()["questions"]["question $i"]["option 1"]),
);
The error I am getting is
The argument type 'Object?' can't be assigned to the parameter type 'int'. 'Object' is from 'dart:core'. setSelectedRadio(val);
I have checked the runtime type of value and it is returning int.
Pass int as a generic argument to your RadioListTile.
Replace this
RadioListTile(...)
with this
RadioListTile<int>(...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With