I have a method called getData for a stateful widget
void getData() async{
var bitCoinPrice1 = (await coinData.getPriceData('BTC$selectedCurrency')).toStringAsFixed(2);
bitCoinPrice = bitCoinPrice1;
}
I am calling this method inside a drop down change event
onChanged: (String newValue) {
setState(
() {
selectedCurrency = newValue;
print("Selected currency changed to $selectedCurrency");
getData();
},
);
}
Unless I enclose the contents in getData in another setState(), the value of bitcoinPrice doesn't reflect in the widget. My questions is : If call to getData() is already inside setState(), why does it require to have another setState() call inside getData() to update the widget?