Dart Programming – truncate Method

  • Post author:
  • Post category:Dart
  • Post comments:1 Comment
dart programming truncate method

In this guide, we will discuss truncate Method in Dart Programming Language. Returns an integer after discarding any fractional digits.

Syntax

Number.truncate()

Return Value

Returns an int without decimal points.

Example

void main() { 
   double n1 = 2.123; 
   var value = n1.truncate(); 
   print("The truncated value of 2.123 = ${value}"); 
} 

It will produce the following output −.

The truncated value of 2.123 = 2 

Next Topic : Click Here

This Post Has One Comment

Leave a Reply