How can a number be rounded up to the nearest whole number in Flutter?
The Num round
methods rounds to the nearest integer. How can one always round up?
You can use the .ceil()
method to achieve what you want.
Example:
print(-0.1.ceil()); => -1
print(1.5.ceil()); => 2
print(0.1.ceil()); => 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With