0

How can I execute a function at a specific time with flutter and firebase? I want to allow the user of my app to send messages to other users at a specific time. Right now, they are sent when the message is created, but I would like to allow the user to schedule the message.

Any idea? I have looked at the Timer class of Flutter, but it does not seem to be useful for this.

southernKid33
  • 351
  • 1
  • 2
  • 14
  • You want the app to send the message on behalf on a user. You could schedule a background task on the device, which calls the function. https://stackoverflow.com/questions/51706265/how-to-schedule-background-tasks-in-flutter I don't know if this works. – Ben Butterworth May 06 '20 at 09:13

1 Answers1

1

According to me handling this on flutter(frontend) will be a bad idea. You can look into firebase cloud function and scheduling of cloud functions to achieve the result. For example, you can have a boolean to show/hide the message in your message model and use cloud function to update it accordingly on the scheduled time.

Shubham Gupta
  • 1,917
  • 1
  • 10
  • 16