The `toDouble` method converts the given number to a double.
The syntax of double.toDouble() method is:
double toDouble()
This toDouble() method of double return this num
as a double
.
double.toDouble() returns value of type double
.
In this example,
num
with a value of 10
.toDouble
method on num
.void main() {
int num = 10;
double result = num.toDouble();
print('Result: $result');
}
Result: 10
In this example,
num
with a value of 100
.toDouble
method on num
.void main() {
BigInt num = BigInt.from(100);
double result = num.toDouble();
print('Result: $result');
}
Result: 100
In this Dart tutorial, we learned about toDouble() method of double: the syntax and few working examples with output and detailed explanation for each example.