The toInt() function converts the number to an integer and returns it.
The following image shows how toInt() works in Dart.
number.toInt()
This function does not require a parameter.
toInt() returns the integer part of a number.
The code below shows the use of the toInt() function in Dart.
import 'dart:convert';void main() {//positive numberprint("The value of (1.5).toInt(): ${(1.5).toInt()} ");// negative numberprint("The value of (-5.6).toInt(): ${(-5.6).toInt()} ");//zeroprint("The value of (0).toInt(): ${(0).toInt()}");}
data:convert library.void main function.1.5 using toInt().-5.6 using toInt().0 using toInt().