I have a To Do List with things to do daily like 'Drink Water' and so on. So now I want that when the user has checked a To Do, the next day it should be unchecked again. How can I implement this?
Right now my Code looks like this:
class ToDoScreen extends StatefulWidget {
const ToDoScreen({Key key}) : super(key: key);
@override
_ToDoScreenState createState() => _ToDoScreenState();
}
class _ToDoScreenState extends State<ToDoScreen> {
List toDos = ['Train Today', 'Drink Water'];
bool value = false;
void addToDo(String newToDo) {
setState(() {
toDos.add(newToDo);
});
Navigator.of(context).pop();
}
void newEntry() {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
content: TextField(
onSubmitted: addToDo,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10)),
icon: Icon(Icons.text_snippet_outlined),
labelText: 'New To Do'),
),
);
});
}
As Yeasin Sheikh said in the comment, first of all you need to save your data somewhere, otherwhise you don't have nothing to reset.
I read in the comments that you'd like to use Firebase.
So I suppose you'll be storing data in Firebase Firestore.
The best way to perform such reset, in my opinion, is to use a Firebase Function (docs).
You could see them as server side code. From there you can define a function to access your DB and reset the data.
To trigger the function once a day, you should use an external service to call the function.
I found this question which could help you: here