Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an int.INFINITY for Dart?

Tags:

dart

I see there is a double.INFINITY but I can't see a way to say "int INFINITY". Which is interesting, because I see I can do some_integer.isInfinite.

What's a way to say int.INFINITY in Dart? Does that even make sense?

like image 252
Seth Ladd Avatar asked Sep 01 '15 18:09

Seth Ladd


1 Answers

No. All Dart integers are finite. You can ask 42.isInfinite, but the answer is predictably false. If you check the code of the int class, you'll like find bool get isInfinite => false; somewhere.

The reason the getter is there at all is that it's defined on num, the superclass of int and double, and you can do many operation on numbers without knowing whether they are integers or doubles.

like image 137
lrn Avatar answered Oct 09 '22 18:10

lrn