'How to delete document automatically when it matches the time inside firebase for flutter? [duplicate]
I am new to flutter. I am trying to delete a particular document when the datefrom field matches with current time. How and where shall I call the delete function? Note: It must delete even when the app is not in use

This is my current code:
getText() {
if (dateTime == null) {
return 'Select Datetime';
} else {
return DateFormat('MM/dd/yyyy HH:mm').format(dateTime!);
}
deletetask() async {
if (time == getText()){
await FirebaseFirestore.instance
.collection('mytasks')
.doc('time')
.delete()
.then((value) => FirebaseStorage
.instance
.refFromURL('image')
.delete());
}
Solution 1:[1]
I believe what you're looking for are scheduled functions and they are documented here.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Vandad Nahavandipoor |
