I want to trigger automatically trigger a function when a screen is pushed on to the stack. I have been doing some research and I think this could be achieved by extending WidgetsBindingObserver class.
Once I have extended it, calling didPushRoute method should be the way to go. So the first thing is to ask if I could be right with this approach.
The second question, and request if you will, would be to ask for a specific implementation or example of this, if it’s the case that the mentioned approach is correct. Doing the same when popping a route is another thing I want, but I think it is on the same line. The main idea of this approach would be to make specific things happen automatically when navigating.
I am looking for something that always happen when the current route / or a specific stateless or stateful gets covered by another screen, rather than manually executing a function with navigator, otherwise I would need to do this for every new push I want to do.
Thanks in advance for the feedback and let me know if have to explain something deeper of what I am trying to achieve.