I have a simple program below. The output is 64.5 it only shows one decimal value but I wanted it to display the last two decimal values.
Ex. Your change is 64.50 USD
How can I achieve this in dart/flutter?
void main() {
double money = 80.00;
double price = 15.50;
double change = money - price;
print('Your change is $change USD');
}
double. You'd be much better off storing the number of cents (or whatever the smallest indivisible unit of currency is) asintand then printing it in a friendlier format at the end. If you usedouble, you'll find that $0.10 + $0.10 + $0.10 is not $0.30 due to floating point error.