how to add if (mounted) for setState action on Pageload

Hi everyone, I have a function that runs on a loop that clearsthecached query and gets new data every 40 seconds aprox.

WhatsApp Image 2023-08-03 at 16.16.40.jpeg
60.24KB

But it is giving me errors when I am not on the page that has the listview to update.

WhatsApp Image 2023-08-03 at 16.12.10.jpeg
143.59KB

I have read various ways to fix this and have seen many people use an if mounted function in their code.

How could we replicate this in flutterflow or how can we put a conditional action to only run this action when using said screen

WhatsApp Image 2023-08-03 at 16.48.39.jpeg
63.41KB

All suggestions would be helpful.

Thanks

1
13 replies