How to round double with precision after the decimal point in Dart

1 Answer

0 votes
void main() {
    double d = 3.5689;
    
    String s = d.toStringAsFixed(2);
    
    d = double.parse(s);
    
    print(s); 
    print(d); 
}




/*
run:

3.57
3.57

*/

 



answered Oct 7, 2022 by avibootz

Related questions

1 answer 179 views
1 answer 126 views
126 views asked Oct 7, 2022 by avibootz
1 answer 172 views
172 views asked May 5, 2023 by avibootz
1 answer 167 views
167 views asked Dec 19, 2022 by avibootz
2 answers 232 views
2 answers 203 views
203 views asked Oct 19, 2022 by avibootz
...