getDates method
void
getDates()
Implementation
void getDates() {
// Get current date
var date = DateTime.now();
String formattedDate =
DateFormat('MM-dd-yyyy').format(date);
currentDate.value = formattedDate;
toDate.value = formattedDate;
// Get date one year before the current date
DateTime oneYearBefore = DateTime(date.year - 1, date.month, date.day + 1,
date.hour, date.minute, date.second);
String formattedDateOneYear =
DateFormat('MM-dd-yyyy').format(oneYearBefore);
fromDate.value = formattedDateOneYear;
print('Current Date: $currentDate');
print('One Year Before: $oneYearBefore');
}