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
Pingback: Dart Programming - toString Method | Adglob Infosystem Pvt Ltd