How to convert float to string with 2 decimal places in Dart

1 Answer

0 votes
void main() {
    var f = 787324.9751;
     
    var s = f.toStringAsFixed(2);
     
    print(s);
}
 
 
 
/*
run:
 
787324.98
 
*/

 



answered Feb 12, 2023 by avibootz
edited Feb 12, 2023 by avibootz

Related questions

1 answer 113 views
2 answers 130 views
2 answers 119 views
2 answers 146 views
...