From d205d403851917c14fa38f3d894a5c7f19e2a071 Mon Sep 17 00:00:00 2001 From: Prasanna Anbazhagan Date: Sun, 28 Apr 2024 22:36:09 +0530 Subject: [PATCH] consider qty as 1 if it is null --- lib/presentation/create_investment_presenter.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/presentation/create_investment_presenter.dart b/lib/presentation/create_investment_presenter.dart index d7d7875..7842d3b 100644 --- a/lib/presentation/create_investment_presenter.dart +++ b/lib/presentation/create_investment_presenter.dart @@ -167,7 +167,10 @@ class CreateInvestmentViewState { List baskets = List.empty(growable: false); - double get totalValue => (value ?? 0) * (qty ?? 1); + double get totalValue { + if (qty == 0 || qty == null) return value ?? 0; + return (value ?? 0) * qty!; + } bool isValid() { final value = this.value;