Convert Double to Integer in Dart

In this Dart language tutorial we learn how to convert double value into int value in a Dart program.

How to convert double to int in Dart

To convert double value to int we can use the toInt() function from a double variable as below.

double doubleValue = 12.74;
int intValue = doubleValue.toInt();

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

void main() {
  double doubleValue = 12.74;
  int intValue = doubleValue.toInt();

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

Happy Coding 😊

Convert Double to String in Dart

Convert Integer to Double in Dart