getAmountById method
Implementation
double getAmountById(String id) {
try {
final matchingMode = mode.firstWhere(
(mode) => mode.id == id,
orElse: () => submit.CollectPaymentModeList(
id: "",
amountPaid: submit.AmountPaid(amount: 0.0)), // Default value
);
return matchingMode.amountPaid?.amount ?? 0.0;
} catch (e) {
debugPrint("Error retrieving amount: $e");
return 0.0; // Return 0.0 in case of an error
}
}