getSavingsByPercentage function
Implementation
Future<List> getSavingsByPercentage()async{
List userRecords = [];
//total amount in the account
final results = await getRecords("savings");
List items = results.items;
int income = await getIncomes();
for (var element in items) {
userRecords.add({
"name":"Savings",
"color":Color(greenIntColor),
"amount": (int.parse(element.data['amount'].toString())/income*100).roundToDouble()
});
}
print(userRecords);
return userRecords;
}