String radioValue;
//
Column(
children: <Widget>[
Row(
children: <Widget>[
Radio(
activeColor: Colors.redAccent,
onChanged: (String val) {
setRadioValue(val);
},
value: 'First',
groupValue: radioValue,
),
Text("Choice1")
],
),
Row(
children: <Widget>[
Radio(
activeColor: Colors.redAccent,
onChanged: (String val) {
setRadioValue(val);
},
value: 'Second',
groupValue: radioValue,
),
Text("Choice 2")
],
),
Row(
children: <Widget>[
Radio(
activeColor: Colors.redAccent,
onChanged: (String val) {
setRadioValue(val);
},
value: 'Third',
groupValue: radioValue,
),
Text("Choice 3")
],
)
],
)
//
setRadioValue(String value) {
setState(() {
radioValue=value;
print(radioValue);
});
}