The floor()
function in Dart returns the next largest integer that is less than or equal to a specified number.
The figure below shows the mathematical representation of the floor()
function.
number.floor()
This function does not require a parameter.
The floor()
function returns the next largest integer less than or equal to the number.
The code below demonstrates the use of the floor()
function in Dart.
import 'dart:convert';void main() {//positive numberprint("The value of (1.5).floor(): ${(1.5).floor()} ");// negative numberprint("The value of (-5.5).floor(): ${(-5.5).floor()} ");//zeroprint("The value of (0).floor(): ${(0).floor()}");}
1.5
using floor()
.-5.5
using floor()
.0
using floor()
.