Round Up Number in Dart
flutter round double to int

Hi Guys, Welcome to Proto Coders Point. In this flutter dart article let’s learn how to round up a number in Dart Language.

Dart Round Double to Integer

In dart to round up a number to the nearest integer, we can make use of a method round(). This round() method in dart convert double to int. In simple words the decimal point number will get converted to closest integer number.


DoubleConverted ToInteger

To use dart round() method, we need to import foundation.dart package.

Example: dart convert double to int

import 'package:flutter/foundation.dart';

void main(){
 var n = 15.5199;
  print(n.round());      // 16 
  var x = 4.49;
   print(x.round());     //  4 
  var y = -1.50;
   print(y.round());       // -2 
  var z = 0.5;
   print(z.round());      //   1
  var a = 0.4;
   print(a.round());       //     0


Learn More on dart official docs.