Reload homepage after button pressed in notification of app

I am in the middle of making a flutter application which revolves around reminders. When the time comes, the reminder sends a notification (I am using awesome_notifications for notifications) with a done button. I want to make it so the reminder is removed from the homepage when the done button is pressed.

Case 1: App is closed.
I can just update my Hive database and when the app opens up, there will not be any need to do any editing as the reminder has already been removed.

Case 2: App is open. Precisely Homepage is opened.
All the reminders are shown in the homepage. If the notification arrives when app is opened. I can remove the reminder from the database but how do I refresh the homepage.

Another question could be that how do I even check if the homepage is opened. If it’s not opened, I could be refreshing a page which isn’t opened, ending up with errors.

Should I refresh the homepage every second with Timer.periodic? Wouldn’t that be excessive on the application?

Leave a Comment