The `isFinite` property checks if the number is finite.
The syntax of double.isFinite property is:
bool isFinite
This isFinite property of double true if the number is finite; otherwise, false.
double.isFinite returns value of type bool
.
In this example,
num
with a finite value of 3.14
.isFinite
property to check if num
is finite.void main() {
double num = 3.14;
bool isNumFinite = num.isFinite;
print('Is 3.14 finite? $isNumFinite');
}
Is 3.14 finite? true
In this example,
num
with a value of positive infinity.isFinite
property to check if num
is finite.void main() {
double num = double.infinity;
bool isNumFinite = num.isFinite;
print('Is infinity finite? $isNumFinite');
}
Is infinity finite? false
In this example,
num
with a value of NaN.isFinite
property to check if num
is finite.void main() {
double num = double.nan;
bool isNumFinite = num.isFinite;
print('Is NaN finite? $isNumFinite');
}
Is NaN finite? false
In this Dart tutorial, we learned about isFinite property of double: the syntax and few working examples with output and detailed explanation for each example.