Convert Integer to Double in Dart

In this Dart tutorial we learn how to convert an int value into double value in Dart program by using the toDouble() function.

How to convert int to double in Dart

To convert an int value into double value we can use the toDouble() function as below.

int number = 77;
double doubleValue = number.toDouble();

The following example Dart program to show you in more detail how to use the toDouble() function to convert int value to double value.

void main() {
  int intValue = 2022;
  double doubleValue = intValue.toDouble();

  print('Integer value: ${intValue}');
  print('Double value: ${doubleValue}');
}
The output as below.
Integer value: 2022
Double value: 2022.0

Happy Coding 😊

Convert Integer to String in Dart

Convert Double to Integer in Dart