formattedPrice function
Returns a string representing a formatted price with currency
A custom symbol
can be provided to be used instead
Implementation
String formattedPrice(double? price, [String? symbol]) {
if (price == null) return "0";
return "${symbol ?? "\$"}${price.toStringAsFixed(2)}";
}