🚗🏍️ Welcome to Motoshare!

Turning Idle Vehicles into Shared Rides & New Earnings.
Why let your bike or car sit idle when it can earn for you and move someone else forward?

From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.

With Motoshare, every parked vehicle finds a purpose. Partners earn. Renters ride. Everyone wins.

Start Your Journey with Motoshare

Dart/Flutter – How to convert one dataType to other Data

Uncategorized

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
 
}
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x