Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter/Dart number handling ability

Tags:

flutter

dart

I an kind of new in Flutter. I want to make a calculator with a large input. considering 30/40 digit each number. Can anybody help me with how I can do so? Like in android I used "BigDecimal" what is the alternative of that in Flutter?

like image 485
Asfaque Ahmed Avatar asked Oct 29 '25 00:10

Asfaque Ahmed


1 Answers

You can use the decimal package.

// with double
print(0.2 + 0.1); // displays 0.30000000000000004

// with decimal
print(Decimal.parse('0.2') + Decimal.parse('0.1')); // displays 0.3
like image 177
Alexandre Ardhuin Avatar answered Oct 30 '25 15:10

Alexandre Ardhuin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!