I have a created custom function in which i want create task automatically and its working the only problem i am facing is that i am not able store the value which is generated from the output in the database Supbase.
In the image you can see that i am generating duedate but when i run the function in database the due date colm is NULL and rest all values are entering ,how to add that duedate value in my database Supabase?????
Can anyone help me this problem????
String? automatictasktestingfucntion(
String? enddate,
String? taskname,
String? description,
String? duedate,
) {
/// MODIFY CODE ONLY BELOW THIS LINE
// Check if any of the required arguments are missing
if (enddate == null || taskname == null || description == null) {
return null;
}
// Parse the end date
final formatter = DateFormat('yyyy-MM-dd');
final endDate = formatter.parse(enddate);
// Get the current date
final currentDate = DateTime.now();
// Create a list to store task messages
final List<String> taskMessages = [];
// Iterate from the current date until the end date, creating tasks for each Tuesday
for (DateTime date = currentDate;
date.isBefore(endDate.add(Duration(days: 1))); // Include end date
date = date.add(Duration(days: 1))) {
if (date.weekday == DateTime.tuesday) {
// Create due date based on the current date
final dueDate =
date.subtract(Duration(days: date.weekday - DateTime.tuesday));
// Create a task message with the provided details, end date, and due date
final taskMessage =
'Task: $taskname\nDescription: $description\nEnd Date: ${formatter.format(endDate)}\nDue Date: ${formatter.format(dueDate)}';
taskMessages.add(taskMessage);
}
}
// Combine task messages into a single string separated by newlines
final combinedTaskMessages = taskMessages.join('\n');
return combinedTaskMessages;
/// MODIFY CODE ONLY ABOVE THIS LINE
}