Int to dubble
To convert a int to double in Dart, we can use one of the built-in methods depending on your need:
void main() {
int i = 5;
print(i.toDouble()); // 5.0
}
toInt( ) or truncate( ):
void main() {
dubble i = 5.0;
print(i.toInt()); // 5
}
round( ):
return the closest/nearest integer.
void main() {
int i = 4.7;
print(i.round()); // 5.0
}
ceil( ):
return the least integer that is not smaller than this number.
void main() {
int i = 5.3;
print(i.ceil()); // 5.0
}
floor( ):
return the greatest integer not greater than this number
void main() {
int i = 5.3;
print(i.floor()); // 5
}

I’m Abhishek, a DevOps, SRE, DevSecOps, and Cloud expert with a passion for sharing knowledge and real-world experiences. I’ve had the opportunity to work with Cotocus and continue to contribute to multiple platforms where I share insights across different domains:
-
DevOps School – Tech blogs and tutorials
-
Holiday Landmark – Travel stories and guides
-
Stocks Mantra – Stock market strategies and tips
-
My Medic Plus – Health and fitness guidance
-
TrueReviewNow – Honest product reviews
-
Wizbrand – SEO and digital tools for businesses
I’m also exploring the fascinating world of Quantum Computing.