I have a list that stored by sqflite in flutter app, when i open the page i run this code in initState method to produce elements :
String _val_s_list=values_list_r.map((e) => e!=null ? e.s_redio_q : ' ').toString();
print("val_s_list: $_val_s_list"); printed: ///val_s_list: (1)
///method to return a string
choosen_radio_s(_val_s_list);
out of init state defined method as below:
String val_s;
String choosen_radio_s(_val_s_list){
setState(() {
if(_val_s_list=="1"){
return val_p1="1";
}
else{
return val_p1="2";
}
});
}
///print: val_s: 2
but i can not understand why this is not currect on first condition and always returns val_p1="2", could some one help me about it??
Aucun commentaire:
Enregistrer un commentaire