getTotalAmount method

double getTotalAmount()

Implementation

double getTotalAmount() {
  try {
    return mode.fold(
        0.0, (sum, item) => sum + (item.amountPaid?.amount ?? 0.0));
  } catch (e) {
    print("Error calculating total amount: $e");
    return 0.0; // Return 0 if an error occurs
  }
}