Dart Programming - toInt Method


Advertisements

This method returns the integer representation of the number's value.

Syntax

Number.toInt()

Return Value

Returns an int representing the specified Number object.

Example

void main() { 
   double n1 = 2.0; 
   var value = n1.toInt(); 
   print("Output = ${value}"); 
} 

It will produce the following output −.

Output = 2
dart_programming_numbers.htm
Advertisements