Returns the integer obtained by discarding any fractional part of this number.
Rounds the number towards zero.
Throws an UnsupportedError if this number is not finite (NaN or an infinity).
print(2.00001.truncate()); // 2 print(1.99999.truncate()); // 1 print(0.5.truncate()); // 0 print((-0.5).truncate()); // 0 print((-1.5).truncate()); // -1 print((-2.5).truncate()); // -2
int truncate();
© 2012 the Dart project authors
Licensed under the BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.18.5/dart-core/double/truncate.html