diff --git a/lib/domain/models/basket.dart b/lib/domain/models/basket.dart index 88a7e22..8f79127 100644 --- a/lib/domain/models/basket.dart +++ b/lib/domain/models/basket.dart @@ -28,7 +28,7 @@ class Basket { .then((investments) => Future.wait(investments .map((investment) => investment.getTotalInvestedAmount()))) .then((investedAmounts) => - investedAmounts.reduce((value, element) => value + element)); + investedAmounts.fold(0, (value, element) => value + element)); } Future getValue({final bool considerFuturePayments = false}) async { @@ -38,7 +38,7 @@ class Basket { .map((investmentDO) => Investment.from(investmentDO: investmentDO))) .then((investments) => Future.wait(investments .map((investment) => investment.getValueOn(date: DateTime.now(), considerFuturePayments: considerFuturePayments)))) - .then((values) => values.reduce((value, element) => value + element)); + .then((values) => values.fold(0, (value, element) => value + element)); } Future> getInvestments() { diff --git a/lib/domain/models/goal.dart b/lib/domain/models/goal.dart index 16393b7..c5a34ee 100644 --- a/lib/domain/models/goal.dart +++ b/lib/domain/models/goal.dart @@ -1,5 +1,3 @@ -import 'dart:ffi'; - import 'package:wealth_wave/api/apis/goal_investment_api.dart'; import 'package:wealth_wave/api/apis/investment_api.dart'; import 'package:wealth_wave/api/db/app_database.dart'; @@ -89,7 +87,7 @@ class Goal { {required final int investmentId, required final double split}) async { return _goalInvestmentApi .create(goalId: id, investmentId: investmentId, split: split) - .then((goalInvestmentDO) => Void); + .then((goalInvestmentDO) => {}); } Future updateTaggedInvestment( @@ -98,13 +96,13 @@ class Goal { required final double split}) async { return _goalInvestmentApi .update(id: id, goalId: id, investmentId: investmentId, split: split) - .then((goalInvestmentDO) => Void); + .then((goalInvestmentDO) => {}); } Future deleteTaggedInvestment({required final int investmentId}) { return _goalInvestmentApi .deleteBy(goalId: id, investmentId: investmentId) - .then((count) => Void); + .then((count) => {}); } Future getIRR() async { diff --git a/lib/domain/models/investment.dart b/lib/domain/models/investment.dart index 8fce05c..3fa79de 100644 --- a/lib/domain/models/investment.dart +++ b/lib/domain/models/investment.dart @@ -1,5 +1,3 @@ -import 'dart:ffi'; - import 'package:wealth_wave/api/apis/basket_api.dart'; import 'package:wealth_wave/api/apis/goal_api.dart'; import 'package:wealth_wave/api/apis/goal_investment_api.dart'; @@ -166,7 +164,7 @@ class Investment { } Future deleteSIP({required final int sipId}) async { - return _sipApi.delete(id: sipId).then((count) => Void); + return _sipApi.delete(id: sipId).then((count) => {}); } Future createTransaction( @@ -203,14 +201,14 @@ class Investment { Future deleteTransaction( {required final int id}) async { - return _transactionApi.deleteBy(id: id).then((count) => Void); + return _transactionApi.deleteBy(id: id).then((count) => {}); } Future tagGoal( {required final int goalId, required final double split}) async { return _goalInvestmentApi .create(goalId: goalId, investmentId: id, split: split) - .then((goalInvestmentDO) => Void); + .then((goalInvestmentDO) => {}); } Future updateTaggedGoal( @@ -219,13 +217,13 @@ class Investment { required final double split}) async { return _goalInvestmentApi .update(id: id, goalId: goalId, investmentId: id, split: split) - .then((goalInvestmentDO) => Void); + .then((goalInvestmentDO) => {}); } Future deleteTaggedGoal({required final int goalId}) { return _goalInvestmentApi .deleteBy(goalId: goalId, investmentId: id) - .then((count) => Void); + .then((count) => {}); } Future getIRR() async { diff --git a/lib/domain/models/sip.dart b/lib/domain/models/sip.dart index 63eb151..add4e36 100644 --- a/lib/domain/models/sip.dart +++ b/lib/domain/models/sip.dart @@ -1,5 +1,3 @@ -import 'dart:ffi'; - import 'package:wealth_wave/api/apis/investment_api.dart'; import 'package:wealth_wave/api/apis/transaction_api.dart'; import 'package:wealth_wave/api/db/app_database.dart'; @@ -94,11 +92,11 @@ class SIP { } Future deleteTransaction({required final int transactionId}) async { - return _transactionApi.deleteBy(id: transactionId).then((count) => Void); + return _transactionApi.deleteBy(id: transactionId).then((count) => {}); } Future deleteTransactions() async { - return _transactionApi.deleteBy(sipId: id).then((count) => Void); + return _transactionApi.deleteBy(sipId: id).then((count) => {}); } static SIP from({required final SipDO sipDO}) {