What is floor() in dart?.

Source: Nagaraj Alagusundaram

What is a floor in Dart?

As per the official documentation,

The greatest integer no greater than this number.

Rounds fractional values towards negative infinity.

The number must be finite (see isFinite).

If the value is greater than the highest representable positive integer, the result is that highest positive integer. If the value is smaller than the highest representable negative integer, the result is that highest negative integer.

Sample

void main() { 
   var a = 2.8; 
   print("The floor value of 2.8 = ${a.floor()}"); 
} 
The floor value of 2.8 = 2

Here is the working example of the floor().