0
double? dTemprature = weather.temperature?.celsius;

sTemprature = dTemprature.toString();

List<String> list = sTemprature.split('.');

sTemprature = list[0] + "." + list[1].substring(0,1);

print ("Weather Temperature: "+sTemprature.toString());

its coming 26.4000000000000 I wanted 2.4

1 Answers1

-1

You can try the below method, double number = double.parse(sTemprature.toStringAsFixed(1));