The `isInfinite` property in Dart returns true if the number is positive infinity or negative infinity; otherwise, false.
The syntax of int.isInfinite property is:
bool isInfinite
This isInfinite property of int true if the number is positive infinity or negative infinity; otherwise, false.
int.isInfinite returns value of type bool
.
In this example,
infinity
with the value double.infinity
.isInfinite
property to check if it is infinite.void main() {
double infinity = double.infinity;
bool isInfinite1 = infinity.isInfinite;
print('Is $infinity infinite? $isInfinite1');
}
Is Infinity infinite? true
In this example,
negativeInfinity
with the value -double.infinity
.isInfinite
property to check if it is infinite.void main() {
double negativeInfinity = -double.infinity;
bool isInfinite2 = negativeInfinity.isInfinite;
print('Is $negativeInfinity infinite? $isInfinite2');
}
Is -Infinity infinite? true
In this example,
num
with the value 10.0.isInfinite
property to check if it is infinite.void main() {
double num = 10.0;
bool isInfinite3 = num.isInfinite;
print('Is $num infinite? $isInfinite3');
}
Is 10 infinite? false
In this Dart tutorial, we learned about isInfinite property of int: the syntax and few working examples with output and detailed explanation for each example.