makeDecimal method
Implementation
String makeDecimal(String amount) {
if (isValidDecimal(amount)) {
try {
double parsedAmount = double.parse(amount);
return parsedAmount.toStringAsFixed(2);
} catch (e) {
return '0.00';
}
}
// If the amount is not a valid decimal, try converting it
try {
double parsedAmount = double.parse(amount);
return parsedAmount.toStringAsFixed(2);
} catch (e) {
return '0.00';
}
}