Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the maxium value of an Integer in dart?

Tags:

dart

In java we can just Integer.maxValue but dart there is not this method.

I am using int max = 1<<32 but this doesn't work properly when compiling to javascript.

What is the best way to get the integer maximum value using dart language?

like image 941
Daniel Oliveira Avatar asked Dec 01 '25 02:12

Daniel Oliveira


2 Answers

I was using dart_numerics package in my app for another reason and found it while typing

enter image description here

like image 143
Pinkesh Darji Avatar answered Dec 03 '25 17:12

Pinkesh Darji


double.maxFinite.toInt() // e.g. 9223372036854775807 on x86_64
like image 36
Hans-J. Schmid Avatar answered Dec 03 '25 19:12

Hans-J. Schmid



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!