getDailyExpenditure function
Implementation
Future<Map<String,dynamic>> getDailyExpenditure()async{
final income = await getIncomes();
final expenses = await getExpense();
final savings = await getSavings();
final balance = (income-expenses)-savings;
//dates left in the month
// Get current date
DateTime now = DateTime.now();
// Get the last day of the current month
DateTime endOfMonth = DateTime(now.year, now.month + 1, 0);
// Calculate the number of days left until the end of the month
int daysLeft = endOfMonth.day - now.day;
final results = await dio.post("$_baseUrl/dailyExpenditure",data:{
"amountLeft":balance,
"daysLeft": daysLeft
});
if(results.data!=null){
Get.find<GraphsController>().isOnline.value=true;
}
return results.data;
}