Search code examples
flutterdartintegerdouble

how to convert this result of calculation flutter


wanna know how to show this result like int number

var symbol = data[index]["symbol"];
  double cureentprice = datarates["price"]["$symbol"];////this double is 1.17150

 double enrty = double.parse(data[index]["entryprice"]);////this is 1.17100

 double lo = cureentprice - enrty ;//i got like this result 0.00050

as you see above i got the result 0.00050 but i need it like this 50

any idea to do somthing like that??


Solution

  • Try This. Maybe This should Help. If this doesn't work then let me know.

    var symbol = data[index]["symbol"];
       double cureentprice = datarates["price"]["$symbol"];////this double is 1.17150
    
     double enrty = double.parse(data[index]["entryprice"]);////this is 1.17100
    
     // double lo = cureentprice - enrty ;//i got like this result 0.00050
    
     int scale = 100000;
     double lo = currentPrice - enrty;
     var value1 = (lo * scale).floor(); 
     var value2 = (lo * scale).ceil();
     print(value1);
     print(value2);